Select 行,其中两列中的值与请求不匹配
Select rows where values in two columns not matching the request
我需要 select 两列值不匹配的所有行
name | surname
John | Smith
John | Colch
John | Rak
Emmy | Oppo
John | Oppo
我怎样才能 select 名称 Name!=John 和 Surname!=Opp 的所有行,所以它会 return 除了最后一个条目之外的所有内容,因为当我尝试
Select * from t where name!='john' and surname!='oppo'
那我就失去艾美了,因为她有相同的姓氏。
我想你实际上想要 OR
逻辑:
SELECT *
FROM t
WHERE name <> 'John' OR surname <> 'Oppo';
我需要 select 两列值不匹配的所有行
name | surname
John | Smith
John | Colch
John | Rak
Emmy | Oppo
John | Oppo
我怎样才能 select 名称 Name!=John 和 Surname!=Opp 的所有行,所以它会 return 除了最后一个条目之外的所有内容,因为当我尝试
Select * from t where name!='john' and surname!='oppo'
那我就失去艾美了,因为她有相同的姓氏。
我想你实际上想要 OR
逻辑:
SELECT *
FROM t
WHERE name <> 'John' OR surname <> 'Oppo';