Home > database >  Refer to how the SQL through the same field to screen display only a (duplicate), query the two tabl
Refer to how the SQL through the same field to screen display only a (duplicate), query the two tabl

Time:09-17

form name uf_czssmz
form name uf_czssmz_dt1

CodePudding user response:

 SELECT * FROM (
SELECT
ROW_NUMBER () OVER (PARTITION BY SFZH ORDER BY id) AS rids
, *
The FROM (
SELECT id, SFZH, 'A' AS flag FROM uf_czssmz
UNION ALL
SELECT id, SFZH, 'B' AS flag FROM uf_czssmz_dt1
) AS t
) AS t
WHERE t.r id=1
  • Related