Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Databases

Bergomy Legendre
Bergomy Legendre
1,026 Points

Find all users with either the last name Hinkley or Pettit SELECT * FROM users WHERE last_name = "Hinkley" OR "Pettit"

Can anyone tell me if my syntax is off? Or am I missing something?

2 Answers

Stuart Wright
Stuart Wright
41,119 Points

This:

WHERE last_name = "Hinkley" OR "Pettit"

Needs to be this:

WHERE last_name = "Hinkley" OR last_name = "Pettit"

Or alternatively:

WHERE last_name IN ("Hinkley", "Pettit")
Bergomy Legendre
Bergomy Legendre
1,026 Points

OHHHHH I forgot the condition. THANK YOU!