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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.