SQL查询A表不包括B表的相同字段的语句

select Events.title,VS_USER.USER_NAME from Events full join VS_USER on Events.id=VS_USER.user_id

//not exists写法


select * from Events where not exists (select * from VS_USER where Events.Id=VS_USER.USER_ID )

//not in 写法

select * from Events where Events.Id not in (select VS_USER.USER_ID from VS_USER where Events.Id=VS_USER.USER_ID )

推荐用后者
效率高,而且没有数据条数的限制

posted on 2008-11-05 23:30  黄洪汉  阅读(993)  评论(0编辑  收藏  举报