Mysql为具有类似where子句的2个查询返回不同的结果

时间:2015-05-21 11:33:17

标签: php mysql sql mysqli

当我输入以下内容时:

SELECT *
FROM `events`
WHERE `tournament` = 'Super 15'
AND `round` = '13'

我回来了:

enter image description here

我插入的时候:

SELECT events.event_id,events.tournament, events.team1, events.team2,events.round,
       events.event_date, events.venue, picks.pick
FROM  events 
INNER JOIN picks ON  events.event_id = picks.event_id
where
events.tournament="Super 15" AND events.round="13"

我GET:

enter image description here

表1:

enter image description here

表2:

enter image description here

我知道为什么我会为具有类似WHERE子句的两个查询获得不同的结果

1 个答案:

答案 0 :(得分:1)

使用以下查询获得相同的结果: - SELECT events.event_id,events.tournament,events.team1,events.team2,events.round,        events.event_date,events.venue,picks.pick 来自事件 LEFT JOIN选择ON events.event_id = picks.event_id 哪里 events.tournament =" Super 15" AND events.round =" 13"