简体   繁体   中英

Unknown column in MySQL 5.7

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:

结构体

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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM