|
-
Jun 25th, 2006, 09:57 AM
#1
Thread Starter
Addicted Member
Resolved [SQL Help]
I got another problem with mine sql query .I have 2 tables , table [person] and table [records]
[person] table
personid
personame
[records] table
no
personid
destination
inside [person] table there is 3 unique person
personid personame
0 James
1 David
2 Sean
inside [records] table
no personid destination
1 0 HK
2 0 RY
3 1 TW
4 0 AK
5 2 SK
6 1 MY
7 2 SK
8 0 AT
9 0 WX
the records i wish to retrieve would be getting the 3 distinct records of the 3 personnel in person table and the latest record in the [records] table .
Desired Results :
6 1 MY
7 2 SK
9 0 WX
What i have tried :
select records.no , personid , personame,destination from person left join records on person.personid=records.personid
The results i got was everything from records table ? wasn't left join joining data from the left only ?
Next i tried adding a distinct keyword , hoping to get unique records
select distinct records.no , personid , personame,destination from person left join records on person.personid=records.personid
still the results was not wat i want ?
So can someone point what is wrong or guide me along with the query ?
Last edited by GOBI; Jun 26th, 2006 at 09:03 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|