dsa4d4789789 2018-01-19 15:50
浏览 11
已采纳

mysqli没有选择正确的数据[关闭]

I have this fiddle file http://sqlfiddle.com/#!9/78b31/20 tho the issue i face is that i wont now just not Display the right data.

For eg. when i try date = 2018-01-24 for the 3rd data (C) is still showing up.

later on i would like to then have the date updated with this function date:

$date = ("Y-m-d");.

so that it would only Show the bowCode /BowID which have not been inserted into comeandtradaysparticipant

Kind regards

Markus

  • 写回答

1条回答 默认 最新

  • dpb_4431 2018-01-19 15:57
    关注

    You are making a LEFT JOIN. What you are looking for is a simple JOIN. LEFT JOIN retrieve the data of the joined table if the ON condition is correct, otherwise it return null values.

    If you try to display a.date you will see that with the LEFT JOIN it will be NULL values.

     SELECT 
           b.id, b.BowCode, b.Info, a.date
        FROM Equipment AS b
        JOIN comeandtrydaysparticipant AS a
                 ON a.BowID = b.BowCode
        WHERE a.BowID IS NULL
        OR(a.BowID=b.BowCode AND a.date<>"2018-01-27");
    
        SELECT 
           b.id, b.BowCode, b.Info, a.date
        FROM Equipment AS b
        JOIN comeandtrydaysparticipant AS a
                 ON a.BowID = b.BowCode
        WHERE a.BowID IS NULL
        OR(a.BowID=b.BowCode AND a.date <> "2018-01-24");
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 怎样才能让鼠标沿着线条的中心线轨迹移动
  • ¥60 用visual studio编写程序,利用间接平差求解水准网
  • ¥15 Llama如何调用shell或者Python
  • ¥20 谁能帮我挨个解读这个php语言编的代码什么意思?
  • ¥15 win10权限管理,限制普通用户使用删除功能
  • ¥15 minnio内存占用过大,内存没被回收(Windows环境)
  • ¥65 抖音咸鱼付款链接转码支付宝
  • ¥15 ubuntu22.04上安装ursim-3.15.8.106339遇到的问题
  • ¥15 blast算法(相关搜索:数据库)
  • ¥15 请问有人会紧聚焦相关的matlab知识嘛?