|
-
Jun 21st, 2006, 08:57 AM
#1
Thread Starter
Addicted Member
[Resolved]Is the DataBase Design correct ?
Hi i have a problem in writing a query , here goes the problem .
I have a table structure like this
[Loan TABLE]
loanId
loandate
returnId
returndate
[User TABLE]
ID
NAME
1)loan.loadid has a relationship with user.id
2)loan.returnid also has a relationship with user.id
Well because the loanid and returnid has a relationship with user.id , is it possible to create a join to display loanid and returnid with respect to name ?
e.g.
[loan table]
loanid loandate returnid returndate
1 monday 3 monday
2 tuesday 1 monday
[user table]
id name
1 alan
2 charlie
3 daniel
Below is the result i which to get
[result]
alan monday daniel monday
charlie tuesday alan monday
[What i have tried]
select user.name , loandate , user.name,returndate from loan inner join user on loan.loanid=user.id and loan.returnid=user.id
Last edited by GOBI; Jun 21st, 2006 at 09:53 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
|