Home > database > On the select () returns the result in question
On the select () returns the result in question
Time:11-10
I ask if the results are displayed in, does not exist, it returns 0. For example: Select * from table1 where id in (1, 2, 3, 4) In fact database only 2 data for id=1, id=2 How will the results to display Id value 1 value1 2 value2 3 0 4 0
CodePudding user response:
Select id=Anderson d, value=https://bbs.csdn.net/topics/isnull (b.v alue, 0) The from (select id=1 union all Union all select id=2 Select id=3 union all Select id=4) a Left the join (select * The from table1 Where id in (1, 2, 3, 4)) b on Anderson, d=b.i d