Mysql 如何在一个架构中使用不相等的值对两个表进行排序

Mysql 如何在一个架构中使用不相等的值对两个表进行排序,mysql,sql,Mysql,Sql,这是我比较两个表的查询,但它返回错误: 子查询返回超过1行 Select id, lname from db.details where id = 'sample' and lname <> (Select lname from db.initialdetail); 您需要在子查询提供集合时使用NOT IN Select id, lname from db.details where id = 'sample'

这是我比较两个表的查询,但它返回错误:

子查询返回超过1行

   Select id, 
          lname 
   from db.details 
   where id = 'sample' 
   and lname <> (Select lname from db.initialdetail);
您需要在子查询提供集合时使用NOT IN

Select id, 
       lname 
from db.details 
where id = 'sample' 
and lname NOT IN (Select lname from db.initialdetail);