I have two tables I'm trying to query:
- tbl_sermons
- tbl_sermons-series
I've tried the MySQL query several different ways but it keeps on coming back with something similar to:
"#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 ''tbl_sermons-series' ON tbl_sermons.series_sermon = 'tbl_sermons-series.id_seri' at line 3"
Here is the query:
SELECT tbl_sermons.title_sermon, tbl_sermons.slug_sermon, tbl_sermons.date_sermon, 'tbl_sermons-series.name_series'
FROM tbl_sermons
LEFT JOIN 'tbl_sermons-series'
ON tbl_sermons.series_sermon = 'tbl_sermons-series.id_series';
I'm sure I'm doing something stupid...Can someone be my second set of eyes?
===
So I had used backticks at one point but that was throwing errors before. I went back to using backticks per the suggestions given (thanks) and now I receive the following error:
1054 - Unknown column 'tbl_sermons-series.name_series' in 'field list'
I am looking at the tbl_sermons-series table and it exists as does the field I am requesting (name_series). If I remove the request for name_series and just leave in tbl_sermons-series.id_series at the end of the LEFT JOIN (to the right of equals in the ON) it throws the same error about tbl_sermons.id_series!
Here are the tablet definitions for tbl_sermons (first) and tbl_sermons-series (second):
The exact code that is currently failing is:
SELECT tbl_sermons.title_sermon, tbl_sermons.slug_sermon, tbl_sermons.date_sermon, `tbl_sermons-series`.`name_series`
FROM tbl_sermons
LEFT JOIN `tbl_sermons-series`
ON tbl_sermons.series_sermon = `tbl_sermons-series`.`id_series`;