当前位置:网站首页>SQL, CTE, flg case problems

SQL, CTE, flg case problems

2022-06-25 04:12:00 CSDN Q & A

Ask everyone one SQL problem ! I want to ask GROUP A-B Part of , Tagged FLG by ‘0’,Group B by ‘1’. It is known that GROUP A yes 520, GROUP B yes 5.FLG by ‘0’ It is 515, But I still get 520. You can have a look at my code Do you ? Maybe something is wrong , thank you !

With PreMatricCTE as
(
SELECT DISTINCT
ID
,CASE
WHEN
(Group B Of where) then 1 else end as CompletedFLG

FROM GROUP A
INNER JOIN GROUP B on A.ID = B.ID

GROUP BY ID
)

SELECT DISTINCT
ID
, MAX (CompletedFLG) as CompletedFLG

FROM PreMatricCTE

WHERE CompletedFLG = '0'

GROUOP BY ID

原网站

版权声明
本文为[CSDN Q & A]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/176/202206181110144123.html