Union Select showing Duplicates

Pisteuo

Registered User.
Local time
Today, 12:26
Joined
Jul 12, 2009
Messages
72
I have a Union query that is producing duplicate records due to small discrepancies in description fields.

I only need the "key" field be unique, but the Query finds entire unique records. I have tried GROUP BY "Key", but I get expression errors. I am not having luck getting SELECT DISTINCT "Key" to work either."

Any suggestions? Thank you.
 
If you only need I only need the "key" field be unique, then you can only include that field.

Try making a query with just the "key" field so that you can make the records unique. Save the query. Create a new query with this newly saved query and any table that have the additional fields that you need.
 
I have a Union query that is producing duplicate records due to small discrepancies in description fields.

I only need the "key" field be unique, but the Query finds entire unique records. I have tried GROUP BY "Key", but I get expression errors. I am not having luck getting SELECT DISTINCT "Key" to work either."

Any suggestions? Thank you.

What you want to do should be able to be done. It would be helpful to see the text of the Queries so that any additional details could be taken into account.
 
The current SQL is at work, but I was able to find this simplified code. The current includes an additional JOIN.

SELECT XYZ.SYS, XYZ.Equip_No, XYZ.Equip_Desc, RF_Systems.Sys_Desc

FROM [SELECT LK_Valve.SYS, Equip_No, Equip_Desc

FROM LK_Valve

UNION SELECT
From_SYS, From_Equip, From_Equip_Desc
FROM LK_Electrical

UNION SELECT
To_SYS, To_Equip, To_Equip_Desc
FROM LK_Electrical]. AS XYZ

LEFT JOIN RF_Systems ON XYZ.Sys = RF_Systems.SYS

ORDER BY Equip_No;


Thank you again.
 

Users who are viewing this thread

Back
Top Bottom