当前位置:51VIP源码软件音乐小游戏下载联盟网络学院数 据 库Mysql → Mysql中左连接的使用

Mysql中左连接的使用

减小字体 增大字体 作者:无从考证  来源:转载  发布时间:2005-10-21 9:56:24 我要发布文章
查询在一个相关的表中不存在的数据,如用户表(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