Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL doubt

Status
Not open for further replies.

rubysaha

Programmer
Apr 1, 2003
5
IN
Hi,

I have three tables T1, T2, T3, T4

T1 has a column rec_no
T2 has columns rec_no, prev_rec_no, origin
T3 has columns main_rec_no and sub_rec_no
T4 has columns rec_no, reference

For value of rec_no in T1, I have to fetch prev_rec_no from T2(where rec_no = rec_no in T1) and the corresponding reference from T4(where rec_no = prev_rec_no in T2)

But if the origin has a value of 'AAAA' in T2(for rec_no = rec_no in T1) then I will have to goto T3 and get the main_rec_no (where sub_rec_no = rec_no in T1) and then the corresponding reference from T4(for rec_no = main_rec_no in T3).

Can anyone pls help ASAP.

Thanks in advance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top