Cody.Stewart
Cody.Stewart

Reputation: 577

Why dosnt this SQL statement work?

SELECT * FROM  conference_attende_options
INNER JOIN conference_options ON conference_attende_options.option_id = conference_options.option_id
WHERE conference_attende_options.PersonID = '4767'
AND option_type = 'guest_field_trip' OR option_type = 'guest_trans_meal'
ORDER BY conference_options.option_id ASC;

It returns all the records with the 'option_type''s of 'guest_field_trip' and 'guest_trans_meal'... it suppose to only return records that match the 'PersonID'.

Upvotes: 0

Views: 45

Answers (1)

TToni
TToni

Reputation: 9391

use brackets like so:

AND (option_type = 'guest_field_trip' OR option_type = 'guest_trans_meal')

Upvotes: 3

Related Questions