Jump to content

mysql query


chaiwei

Recommended Posts

I have a table like this:

job_id, resume_id, status, datestamp

3965 78826 accepted 2009-12-11 16:34:58
3965 79307 accepted 2009-12-17 11:04:36
3965 78826 can-rejected 2010-01-11 11:09:13
3965 56341 suitable 2009-12-03 11:25:58
3965 78826 suitable 2009-12-11 16:34:51
3965 79307 suitable 2009-12-17 11:04:33

I want it become like this

 

job_id, resume_id, status, datestamp

3965 79307 accepted 2009-12-17 11:04:36
3965 78826 can-rejected 2010-01-11 11:09:13
3965 56341 suitable 2009-12-03 11:25:58

 

I can use subquery to do this:

 

SELECT * 
FROM resume_application_status rjs, 
   (SELECT max(datestamp) as datestamp FROM resume_application_status rjs 
    GROUP BY job_id,resume_id ) rjs2 
WHERE rjs.datestamp = rjs2.datestamp 
GROUP BY job_id,resume_id

 

but this is subquery, are there any option to do this without using subquery?

Because I can't create view using subquery

 

Link to comment
https://forums.phpfreaks.com/topic/188009-mysql-query/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.