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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Self reference table

Status
Not open for further replies.

RakhiKalra

Programmer
Jun 6, 2003
41
0
0
IN
Hi ,

I have the following structure:

Item table
----------
ItemId
ItemName

Item Transaction Table
----------------------
TransactionId
GiverItemId
SenderItemId

the data is somewhat like this:

Item table
__________
1 abc
2 xyz
3 pnr
4 rew
5 dds
6 djs
7 dsf

Item Transaction table
---------------------
1 1 2
2 2 4
3 4 3
4 3 7

Now i have a reauirement to build a stored proc in which all the transactions starting from one transaction like, if i want to know the chain for item no 2 it shall give the following result:
2 4
4 3
3 7

if i want to know the chain for item no 3 then it shall give following
3 7

if i want to know the chain for item no 1 then it shall give following
1 2
2 4
4 3
3 7

Please help.. Its urgent.....

Thanks in advance

Rakhi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top