Transact SQL help needed
Posted on 2006-05-31
the goal is to get items with average lead time > 100 days.
i can run this and get desired results:
SELECT ITEMNMBR, VENDORID, AVRGLDTM / 100 AS Expr1
WHERE (AVRGLDTM > 10000)
ORDER BY AVRGLDTM DESC
i need to add in two extra columns from different tables (buyerid from table iv00102 and ABC code from table iv00101), so far im at:
SELECT dbo.IV00103.ITEMNMBR, dbo.IV00103.VENDORID, dbo.IV00103.AVRGLDTM / 100 AS Expr1, dbo.IV00102.BUYERID,
FROM dbo.IV00103 INNER JOIN
dbo.IV00101 ON dbo.IV00103.ITEMNMBR = dbo.IV00101.ITEMNMBR INNER JOIN
dbo.IV00102 ON dbo.IV00103.ITEMNMBR = dbo.IV00102.ITEMNMBR
WHERE (dbo.IV00103.AVRGLDTM > 10000)
ORDER BY dbo.IV00103.AVRGLDTM DESC
this results in multiple lines with the same information, for example an item number might appear 3 times in the results. what am i doing wrong?