一个表一条数据多条件查询并且只要符合条件就显示
答案:1 悬赏:40 手机版
解决时间 2021-04-02 10:14
- 提问者网友:我没有何以琛的痴心不悔
- 2021-04-01 23:17
一个表一条数据多条件查询并且只要符合条件就显示
最佳答案
- 五星知识达人网友:像个废品
- 2021-04-02 00:34
你还能再乱一点吗?我整理了下,语句是这样的
SELECt
facility_user_eco_index_info1.userHr,
facility_user_eco_index_info1.hrDate,
facility_user_eco_index_info2.userGlu,
facility_user_eco_index_info2.gluDate
FROM
facility_user_eco_index_info facility_user_eco_index_info1,
facility_user_eco_index_info facility_user_eco_index_info2
WHERe
facility_user_eco_index_info1.fileNo = "20180922085633"
AND facility_user_eco_index_info1.hrDate = "2018-9-15"
AND facility_user_eco_index_info2.fileNo = "20180922085633"
AND facility_user_eco_index_info2.gluDate = "2018-9-15"但是我不理解为什么你要重复写,而且gluDate、userGlu是有值的,你想要NULL是吗?如果只要你的结果应该这样写
SELECt
hrDate,
userHr,
NULL AS gluDate,
NULL AS userGlu
FROM
facility_user_eco_index_info
WHERe
userHr = "56"
AND hrDate = "2018-9-15"
SELECt
facility_user_eco_index_info1.userHr,
facility_user_eco_index_info1.hrDate,
facility_user_eco_index_info2.userGlu,
facility_user_eco_index_info2.gluDate
FROM
facility_user_eco_index_info facility_user_eco_index_info1,
facility_user_eco_index_info facility_user_eco_index_info2
WHERe
facility_user_eco_index_info1.fileNo = "20180922085633"
AND facility_user_eco_index_info1.hrDate = "2018-9-15"
AND facility_user_eco_index_info2.fileNo = "20180922085633"
AND facility_user_eco_index_info2.gluDate = "2018-9-15"但是我不理解为什么你要重复写,而且gluDate、userGlu是有值的,你想要NULL是吗?如果只要你的结果应该这样写
SELECt
hrDate,
userHr,
NULL AS gluDate,
NULL AS userGlu
FROM
facility_user_eco_index_info
WHERe
userHr = "56"
AND hrDate = "2018-9-15"
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯