jeudi 24 septembre 2015

Sqlite query for fetching latest Exam date time with distinct patientID

In Sqlite db I have a table: Examination with columns ExamID, InternalPID, ExamDateTime

ExamID InternalPID ExamDateTime (from left to right)

1 2 2015-03-11

2 1 2015-11-11

3 4 2015-05-01

4 6 2015-08-10

5 2 2015-04-22

6 1 2014-12-11

7 2 2015-03-12

the query output should be latest Examination date of each patient. i.e the InternalPID should be distinct with its latest ExamDateTime.

Expect output from query:

ExamID InternalPID ExamDateTime

5 2 2015-04-22

2 1 2015-11-11

3 4 2015-05-01

4 6 2015-08-10

Thank you in advance

Aucun commentaire:

Enregistrer un commentaire