两张表合并查询获得联合数据

    SELECT FULLNAME,PDT,BLCMT,CBCT from WK_SHEET_WAIT a WHERE  a.SHID = %SHID% and 
    (exists(select * from WK_SHEET_PROC b where b.SHID=a.SHID) or exists(select * from WK_SHEET_WAIT c where c.SHID=a.SHID)) 
    UNION
    select FULLNAME,PDT,BLCMT,CBCT from  WK_SHEET_PROC where  SHID = %SHID%

你可能感兴趣的:(Sql)