I want to check the data from an invoicing database for possible duplicate
invoices.
I have created an example script below.
I want to return rows where there is a match for both reference_ and
value_,
so in this
example in my SELECT statement I only want to return the two rows that
match
on both
reference_ and value_
CREATE TABLE #TMP
(reference_ varchar(10), suppliercode_ varchar(10), value_ money)
INSERT INTO #TMP VALUES ('A1','123',100)
INSERT INTO #TMP VALUES ('A2','234',100)
INSERT INTO #TMP VALUES ('A1','345',100)
INSERT INTO #TMP VALUES ('A2','234',70)
SELECT * FROM #TMP ORDER BY REFERENCE_


|