Distinct values with last record (1 Viewer)

MilaK

Registered User.
Local time
Today, 00:02
Joined
Feb 9, 2015
Messages
285
Hello query gurus,

I'm trying to display distinct rows with "gene" and "aa_change" fields next to the last "Second_Rev" field entry in table tbl_Variants. I've tried Group By and distinct so far but can't figure out how to display the "Second_Rev" field with the largest id only.

The current out put is attached:

From the shown output I would like to eliminate duplication in "gene" and "aa_change" by finding the "Second_Rev" with the largest id(or last record for a unique gene and aa_change combination). I'm not sure if it's possible with a single query or multiple queries are need? Please advise on how to accomplish the desired outcome.

A sample database is attached.

Thank you, Mila
 

Attachments

  • CurrentOutput.JPG
    CurrentOutput.JPG
    21.7 KB · Views: 82
  • TestInterp.zip
    46.1 KB · Views: 42

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 15:02
Joined
May 7, 2009
Messages
19,233
Try to study the query that ive made.
 

Attachments

  • TestInterp.zip
    20.5 KB · Views: 41

MilaK

Registered User.
Local time
Today, 00:02
Joined
Feb 9, 2015
Messages
285
It's basically two queries combined into one. very cool.
thanks
 

Users who are viewing this thread

Top Bottom