SELECT *
FROM tb
WHERE ((tb.invitor_name = 'aa') and (tb.friendship_id) <> '') or ((tb.acceptor_name = 'bb') and (tb.friendship_id <> ''))
FROM tb
WHERE ((tb.invitor_name = 'aa') and (tb.friendship_id) <> '') or ((tb.acceptor_name = 'bb') and (tb.friendship_id <> ''))
FROM tb
WHERE (invitor_name = 'aa' or acceptor_name = 'bb') and friendship_id <> ''不晓得楼主要实现什么?
不用楼上的那和麻烦吧。这样子就可以了。
tb.acceptor_name 是 'bb'
还有tb.friendship_id可能有两种情况的哦!
一种是!==,另一种是==;
照您这个写法,(tb.invitor_name=='aa' and (tb.friendship_id!=='')) or (tb.acceptor_name=='bb' and (tb.friendship_id ==''))
就不行了啊!
就这段难写!
(tb.invitor_name=='aa' and (tb.friendship_id!=='')) or (tb.acceptor_name=='bb' and (tb.friendship_id!==''))
不知各位看懂了吗??
select * from tb where
(tb.invitor_name='aa' or tb.acceptor_name='bb') and (tb.friendship_id!='')
这样写应该是可以的了.
现在大家都是从你的语句猜你的意思。你一开始写的tb.friendship_id两个都是!==,后面又说
“还有tb.friendship_id可能有两种情况的哦!一种是!==,另一种是==;”实在搞不清楚。
FROM tb
WHERE (tb.invitor_name = 'aa' and tb.friendship_id) <> '') or (tb.acceptor_name = 'bb' and tb.friendship_id <> '')