Reputation: 13
I've searched and searched to no avail for what seems like an incredible stupid question. I have the following query:
SELECT t.team_name, s.stad_name s.built
FROM teams t INNER JOIN
stadiums s
ON s.stad_id = t.team_stad
WHERE s.built < 1950
and I keep getting errors left and right. I've tried putting 1950 in single quotes, double quotes, and everything else. Built is a YEAR(4) data type.
So, how do you compare YEAR data types in mysql?
EDIT: I knew I was staring at this too long, and too late. A comma........thank you for your answers, and kindness.
Upvotes: 1
Views: 81
Reputation: 29051
Put comma (,) between s.stad_name
and s.built
columns and then try it will work. You forgot it
Try this:
SELECT t.team_name, s.stad_name, s.built
FROM teams t
INNER JOIN stadiums s ON s.stad_id = t.team_stad
WHERE s.built < 1950;
Upvotes: 1
Reputation: 2379
SELECT t.team_name, s.stad_name, s.built //You Missed Comma...
FROM teams t INNER JOIN
stadiums s
ON s.stad_id = t.team_stad
WHERE s.built < 1950
Upvotes: 1