Tim C
Tim C

Reputation: 5714

Mysql returns different result for 2 queries with similar where clause

When I enter the following:

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

I get back:

enter image description here

YET when I insert:

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"

I GET:

enter image description here

TABLE 1:

enter image description here

TABLE 2:

enter image description here

ANY idea why im getting different results back for the two queries with similar WHERE clause

Upvotes: 0

Views: 88

Answers (1)

Mukesh Prajapat
Mukesh Prajapat

Reputation: 274

use following query for same result :-

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

Upvotes: 2

Related Questions