SQL Union filters duplicate record statements and obtains data that is not duplicated
$sql = "UNION all->union
--------------------
--How do I get data that is not duplicated in the following sentences?
SELECT DISTINCT top PERCENT KIRINLDS.DBO.TBL personnel adjustment. Department name as department name
From KIRINLDS.DBO.TBL personnel INNER JOIN
KIRINLDS.DBO.TBL orders on KIRINLDS.DBO.TBL personnel. Work Number = KirinLDS.dbo.tbl order. Salesman INNER JOIN
KIRINLDS.DBO.TBL personnel adjusted on KIRINLDS.DBO.TBL. Name = KIRINLDS.DBO.TBL personnel adjustment. Personnel
WHERE (Left (kirinLDS.dbo.tbl order. Fiscal month, 4) = ' 2009 ')
UNION
SELECT DISTINCT top PERCENT KIRINSZ.DBO.TBL personnel adjustment. Department name as department name
From KIRINSZ.DBO.TBL personnel INNER JOIN
KIRINSZ.DBO.TBL orders on KIRINSZ.DBO.TBL personnel. Work Number = KirinSZ.dbo.tbl order. Salesman INNER JOIN
KIRINSZ.DBO.TBL personnel adjusted on KIRINSZ.DBO.TBL. Name = KIRINSZ.DBO.TBL personnel adjustment. Personnel
WHERE (Left (kirinSZ.dbo.tbl order. Fiscal month, 4) = ' 2009 ')
UNION
SELECT DISTINCT Top PERCENT KIRINLDSBJ.DBO.TBL personnel adjustments. Department name as department name
from kirinLDSbj.dbo.tbl people INNER JOIN
KIRINLDSBJ.DBO.TBL orders on KIRINLDSBJ.DBO.TBL personnel. Work Number = KirinLDSbj.dbo.tbl order. Clerk INNER JOIN
KIRINLDSBJ.DBO.TBL personnel adjust on kirinLDSbj.dbo.tbl. Name = KIRINLDSBJ.DBO.TBL personnel adjustment. Person
WHERE (left) KIRINLDSBJ.DBO.TBL orders. Fiscal month, 4 = ' 2009 ')
;
We usually change Union all to Union. Look, the union query shows a record of not repeating oh.