patternsqlMinor
Query WHERE clause and JOIN
Viewed 0 times
querywherejoinandclause
Problem
I'm having an issue using a WHERE clause and JOIN.
Error Code: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'JOIN
LIMIT 0, 1000' at line 1
I'm just trying to limit data set by time "starttime', but I get query error and it refers to
join.
Any ideas? I will be happy to provide more info if required.
SELECT * FROM `CallDetailRecord`
WHERE `StartTime` >=1357102799000
AND `StartTime` <=1357880399000
JOIN `CallEvent` ON `EventID` = `CallEventID`Error Code: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'JOIN
CallEvent ON EventID = CallEventIDLIMIT 0, 1000' at line 1
Execution Time : 0 sec
Transfer Time : 0 sec
Total Time : 0.004 sec
---------------------------------------------------I'm just trying to limit data set by time "starttime', but I get query error and it refers to
join.
Any ideas? I will be happy to provide more info if required.
Solution
Your
Note: You may want to prefix the fields with table names or aliases...
WHERE clause must be after your join, perhaps? SELECT *
FROM CallDetailRecord
JOIN CallEvent ON EventID = CallEventID
WHERE StartTime >= 1357102799000 AND StartTime <=1357880399000Note: You may want to prefix the fields with table names or aliases...
Code Snippets
SELECT *
FROM CallDetailRecord
JOIN CallEvent ON EventID = CallEventID
WHERE StartTime >= 1357102799000 AND StartTime <=1357880399000Context
StackExchange Database Administrators Q#42436, answer score: 2
Revisions (0)
No revisions yet.