当前位置:开发者网络 >> 技术教程 >> 数据库专栏 >> MySQL >> 内容
精彩推荐
分类最新教程
分类热点教程
  
Mysql中左连接的使用
作者:未知
日期:2005-04-29
人气:
投稿:(转贴)
来源:未知
字体:
收藏:加入浏览器收藏
以下正文:

查询在一个相关的表中不存在的数据,如用户表(user)和用户资料表(user_profile),通过id关联,要查出user表中在user_profile中不存在的记录:

select count(*) from?user left join?user_profile On user.id=user_profile.id where user_profile.id is null

复杂条件:

select count(*) from?user left join?user_profile On user.id=user_profile.id where user.level>1 or user_profile.money>10000
相关文章: