-2

我想在下面做一个选择,即使结果是NULL.

查询如下

SELECT id, result
FROM  `fq_account_extend_result` 
WHERE id_extend =5
AND (
id =1
OR id =2
OR id =3
OR id =4
)
ORDER BY id ASC 

结果如下:

id  result
1   testtest
2   asdasd
3   bill

我想包括id_extend = 4,即使结果是空的

id  result
1   testtest
2   asdasd
3   bill
4 
4

2 回答 2

1
SELECT id_extend, result

FROM fq_account_extend_result WHERE id =5 AND id_extend IN (1,2,3,4) ORDER BY id ASC

于 2013-07-29T09:41:20.737 回答
1

试试这个:

   SELECT id_extend, result
    FROM  fq_account_extend_result
    WHERE id =5 AND
    id_extend IN(1,2,3,4)
    OR result is null
    ORDER BY id ASC 
于 2013-07-29T09:44:02.980 回答