SELECT * FROM comments where postId
= 92057 AND auditBy
IS NOT NULL;
SELECT * FROM comments where postId
= 92057 AND auditBy
IS NULL AND userId = 1111;
1
qsl0913 2015-11-17 16:06:50 +08:00
SELECT * FROM comments where postId = 92057 AND (auditBy IS NOT NULL or (auditBy IS NULL AND userId = 1111));
|
2
corboy OP 自己已解决,谢谢。
|
3
barbery 2015-11-17 16:07:02 +08:00
要么条件合并: SELECT * FROM comments where postId = 92057 AND auditBy IS NOT NULL OR (auditBy IS NULL AND userId = 1111)
要么链接来执行: SELECT * FROM comments where postId = 92057 AND auditBy IS NOT NULL UNION ALL SELECT * FROM comments where postId = 92057 AND auditBy IS NULL AND userId = 1111; |
4
lingdong 2015-11-17 16:07:06 +08:00
SELECT * FROM comments where postId = 92057 AND auditBy IS NOT NULL OR (auditBy IS NULL AND userId = 1111);
这样 OK 吗? |
5
ixiaozhi 2015-11-17 16:07:14 +08:00
SELECT * FROM comments where postId = 92057 AND ( auditBy IS NOT NULL ) OR ( auditBy IS NULL AND userId = 1111)
|
7
123123 2015-11-17 19:23:14 +08:00 1
|
9
TangMonk 2015-11-18 10:27:49 +08:00
UNION
|