March 29, 2016 at 7:46 am
Well SQL Server will link the tables together based on the joins you specified. Just making some hopefully not crazy assumptions about your table designs, you would get 1 row for each line in the order items tables that matches the order number, SQL server would join that to the products table so each order item would match 1 product, and then each product would be matched to the vendor.
March 29, 2016 at 8:18 am
I don't recommend using 'comma' joins as this is not the standard and easier to make a mistake. Learn and use JOIN...trust me you'll be better off for it.
March 29, 2016 at 8:21 am
Great thank you ..helps a ton for me
March 29, 2016 at 8:22 am
Fixed query
SELECT prod_name,
vend_name,
prod_price,
quanity
FROM orderitems
INNER JOIN products ON orderitems.prod_id = products.prod_id
INNER JOIN vendors ON products.vend_id = vendors.vend_id
WHERE order_num = 20005;
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
March 29, 2016 at 8:29 am
ok thank you helps a ton
Viewing 5 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply