mysql 查詢存在A表中而不存在B表中的數據

有兩張表,學生信息表infolist:code

學生姓名錶namelist:blog

現要查詢出,存在infolist中,而不存在namelist中的學生,語句以下:class

select * from infolist where (select count(1) as num from namelist where infolist.name = namelist.name) = 0;

查詢結果以下:select

age有些奇葩,不用在乎。im

相關文章
相關標籤/搜索