SELECT P.CODE,
P.STATUS,
G.DESCRIPTION,
x.xref_code,
X.XREF_STATUS
FROM table1.price_data p,
TABLE2.GENERAL_DATA G,
TABLE3.XREF_DATA X
WHERE
P.CODE = G.CODE
AND G.CODE=X.CODE
AND x.code=4545645
AND X.VEHICLE_CODE=9999999
There are literally 30,000 rows to filter through…how do i alter the above query to show only unique values of x.xref_status?
It’s not clear why your X.XREF_STATUS duplicates: there are dups in TABLE3 table? Or, more likely, there are many references to XREF_STATUS values in related records?
If rows differs for other columns than X.XREF_STATUS, you won’t be able to pick one row instead of another to show only unique X.XREF_STATUS values.
A list of unique X.XREF_STATUS values can be obtained with:
This can be joined to other tables to obtain related data, but again if you join with a table containing more than one reference to X.XREF_STATUS this will dup accordingly.
You must aggregate other columns (COUNT, SUM, etc.) to avoid dups.