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 SQL Basics Finding the Data You Want Filtering by Dates

Spencer Lebel
Spencer Lebel
3,125 Points

Need assistance filtering by dates

I'm attempting to filter by dates to find all results for games where "Hessle" was the away_team after Oct. 1 2015. I'm using a WHERE condition and an AND condition. Treehouse has provided a very helpful "there is something wrong with your query" message. I'd appreciate some help!

1 Answer

This is a task from quiz this question is referring to; We're back in the sports team database. There's a results table with the columns id, home_team, home_score, away_team, away_score and played_on . Find all the matches in the results table where "Hessle" was playing away as the away team and if they played on or after October 1st 2015. Date format is "YYYY-MM-DD".

Code should look something like this: SELECT * FROM results WHERE away_team="Hessle" AND played_on>="2015-10-01";

On this task quiz will give OK-ish pointers if you basic syntax is correct ( for instance it will give you a hint "you need to use >=" if you coded > only for date condition ) so without seeing the original poster's code I would assume maybe order of command was not correct syntax-vise.