這是查詢: SELECT a.id, a.userName,if(o.userId=1,'C',if(i.userId=1,'I','N')) AS relation
FROM tbl_users AS a
LEFT JOIN tbl_contacts AS o ON a.id = o.contactId
LEFT JOIN tbl_invites AS i O
所有行我願做一個具體的查詢 select distinct name
from tablename
刪除重複。但是這隻給了我名字。從「選擇表不同的名字:」我想所有的列有一個WHERE條件返回: select *
from tablename
where value= 1
我嘗試這樣做: select *
from tablename
where value = 1 and exi