|
-
Oct 14th, 2003, 03:32 AM
#1
Thread Starter
Lively Member
(Resolved) How to retrieve record from 3 tables by comparing the foreign key?
Hi, I got problem retrieveing data from 3 tables using e foreign key which is the unique identifier.
I am using the staffNo as the unique identifier.If i search e staff record, it should show the staff table and if the loan or zip got his record, then will display all the record out n display in a datagrid.
If he never borrow anything, then there wont be any record in loan n zip, so it will only display the staff record.
How do i acheive it? How do i write the sql statement?
Last edited by berrie_luv; Oct 15th, 2003 at 04:45 AM.
-
Oct 14th, 2003, 09:05 AM
#2
PowerPoster
Try something like this:
SELECT * FROM Staff
JOIN Loan ON StaffNo = StaffNo
JOIN Zip ON staffNo = StaffNo
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
|