Distinct values with last record

MilaK

Registered User.
Local time
Today, 00:50
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: 122
  • TestInterp.zip
    TestInterp.zip
    46.1 KB · Views: 77
Try to study the query that ive made.
 

Attachments

It's basically two queries combined into one. very cool.
thanks
 

Users who are viewing this thread

Back
Top Bottom