Reputation: 1139
I am performing this query:
SELECT C.id, C.content, C.video_id,C.username, C.date_sent, SUM(V.vote) AS vote_total
FROM comments C
LEFT OUTER JOIN comments_votes V
ON C.id=V.comment_id
WHERE c.video_id = '5'
GROUP BY C.id, C.content, C.username, C.video_id, C.date_sent, C.video_id
ORDER BY C.content ASC
And it works fine on my localhost which runs 10.1.21-MariaDB
but my host operates on mySQL 5.7
and when I run the above I get:
Error in query (1054): Unknown column 'c.video_id' in 'where clause'
I am not very knowledgable on SQL but I tried to do some research on SO but most solutions point to a bug in 5.5.
My comments table is this:
Upvotes: 1
Views: 436
Reputation: 90746
It looks like one instance is configured as case-insensitive and the other not. Try to change to C.video_id
(or better yet, never use uppercase in database identifiers).
Upvotes: 3