橙稚 2017-04-14 01:02 采纳率: 33.3%
浏览 785
已采纳

sql语句查询语句问题,

SELECT CESHIXIANGMUMINGCHENG AS "国民",JIANCESHIJIAN AS "动脉硬化",ZONGHEPINGFEN AS "亚健康",BAOGAOURL AS "体成分",FPPGJIROULIANG AS "体成",CSSCDZZY AS "平衡",
CEDINGBUWEI AS "骨密度",SHUZHANGYA AS "血压计",CESHIFANGFA AS "心肺",BTGJXISHUZHI AS "平衡仪",KANGYANENGLI AS "精神" FROM t_users
RIGHT OUTER JOIN t_datacenter ON t_datacenter.HUIYUANHAO = t_users.HUIYUANHAO
RIGHT OUTER JOIN t_tichengfen ON t_tichengfen.HUIYUANHAO = t_users.HUIYUANHAO
RIGHT OUTER JOIN t_dongmaiyinghua ON t_dongmaiyinghua.HUIYUANHAO = t_users.HUIYUANHAO
RIGHT OUTER JOIN t_gonglvche ON t_gonglvche.HUIYUANHAO = t_users.HUIYUANHAO
RIGHT OUTER JOIN t_gumidu ON t_gumidu.HUIYUANHAO = t_users.HUIYUANHAO
RIGHT OUTER JOIN t_pinghengyi ON t_pinghengyi.HUIYUANHAO = t_users.HUIYUANHAO
RIGHT OUTER JOIN t_pinghengyigaoduan ON t_pinghengyigaoduan.HUIYUANHAO = t_users.HUIYUANHAO
RIGHT OUTER JOIN t_tichengfengaoduan ON t_tichengfengaoduan.HUIYUANHAO = t_users.HUIYUANHAO
RIGHT OUTER JOIN t_xueyaji ON t_xueyaji.HUIYUANHAO = t_users.HUIYUANHAO
RIGHT OUTER JOIN t_yajiankang ON t_yajiankang.HUIYUANHAO = t_users.HUIYUANHAO
RIGHT OUTER JOIN t_jingshenyali ON t_jingshenyali.HUIYUANHAO = t_users.HUIYUANHAO
WHERE t_users.HUIYUANHAO="000850"

但是t_datacenter表中,会员号000850是有数据的,就是查不出来。
还是这个链接不行!!

  • 写回答

3条回答 默认 最新

  • chaoguoguo 2017-04-14 09:30
    关注

    右连接以 right join 后的表为主 也就是 t_datacenter 为主, 既然 t_datacenter 有会员号000850是有数据的,你where 条件跟的是 t_users ,结果查不出数据,说明 t_users 这个表没有 000850 这个数据的, 换成 where t_datacenter.HUIYUANHAO="000850" 应该可以 右连接以右表为主

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 树莓派与pix飞控通信
  • ¥15 自动转发微信群信息到另外一个微信群
  • ¥15 outlook无法配置成功
  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题