July 2, 2002 at 12:16 pm
2 tables
tblproduct
shortsku varchar 5,
edp int primary,
name varchar 1000
tblkit
kitedp int primary,
componentedp int
i have shortsku value. there are be multiple records in tblkit for one shortsku(tblproduct.shortsku can also have multiple records). i need to query FSProducts for edp link to FSKits and then get all associated components and then tie each component back to a shortsku.
the edp's form tblkit tie back to edp in tblproduct, meaning:
tblproduct.edp = tblkit.kitedp &
tblproduct.edp = tblkit.componentedp
i need to get all records from tblkit where ed and tie the componentedp back to tblproducts.edp and get the shortsku
for each record.
</cm>
July 2, 2002 at 12:56 pm
What is the requirement for edp (I'm assuming that's what you meant)?
quote:
i need to get all records from tblkit where ed and
K. Brian Kelley
http://www.sqlservercentral.com/columnists/bkelley/
K. Brian Kelley
@kbriankelley
July 2, 2002 at 3:17 pm
basically i need to take a given shortsku, look it up in tblproduct, from there get the edp and join that to tblkit and from there get the componentedp(s). i will then need to tie back to tblproduct and get the shortsku of each componentedp(where tblkit.componentedp=tbproducts.edp). make sense? thanks
</cm>
</cm>
July 2, 2002 at 9:19 pm
If I am understanding your requirements...
SELECT P2.shortsku
FROM tblProduct P1
JOIN tblKit K1 ON P1.edp = K1.kitedp
JOIN tblProduct P2 ON K1.componentedp = P2.edp
WHERE P1.shortsku = @sku
Is that what you are looking for?
K. Brian Kelley
http://www.sqlservercentral.com/columnists/bkelley/
K. Brian Kelley
@kbriankelley
July 3, 2002 at 5:27 am
yes. thank you for your patience and help.
not sure what i would do without this site.
-cm
</cm>
July 3, 2002 at 8:00 am
Glad we could be of help.
K. Brian Kelley
http://www.sqlservercentral.com/columnists/bkelley/
K. Brian Kelley
@kbriankelley
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply