I am using MSSQL2005 and need help to write a SQL statement to achieve the following.
I have 1 tables that I want to create a recordset from.
I want return all records where there are multiple records of any given VENDOR_NO, and for each of those unique VENDOR_NO's there are multiple COST records with the same value.
I hope this is explained clearly.
What I need is all records where the cost and vendor are the same.
I need this...
This SQL statement is working well, however I ran into difficulty adding additional conditions.
Select t.Vendor_no, t.Cost
From Table t INNER JOIN (
Select Vendor_no, Cost
Group by Vendor_no, Cost
Having COUNT(*) > 1
On t.Vendor_no = m.Vendor_no and
t.cost = m.cost
I need to get records where the conditions above are true, and also the BRAND and DEPARTMENT fields from another table are a given value to (to be determined at run time),
(Both tables have ITEM_NO field to match up items)
Thanks in advance,