MySQL Error - "Unknown column in where clause"


I'm having a strange issue. When I use this query:

SELECT count(VID) AS total, UID FROM video WHERE channel LIKE '%|22|%' GROUP BY UID ORDER BY total DESC LIMIT 5

Everything works fine. But when I duplicate the "channel" table and call the new table "channel_cl", then run the exact same query, but with the new table name:

SELECT count(VID) AS total, UID FROM video WHERE channel_cl LIKE '%|22|%' GROUP BY UID ORDER BY total DESC LIMIT 5

I receive this error:

Unknown column 'channel_cl' in 'where clause'

I don't understand why the query is working on the original table, but not after I duplicate the table. Does anyone have any ideas?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

According to your query, the table name is video, not channel.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SpiderstaveAuthor Commented:
Whoops! I got confused because there is a table called channels, and didn't realize it was referencing a column called channels, not the table. That fixed it. Thanks!
No problem. You should have the MySQL manual handy for such occassions. I can never remember the syntax of all those different types of statements either, but the manual lays it out nicely:
SpiderstaveAuthor Commented:
Great resource, thank you!
Oh, just remember to check which version of MySQL you're using and change the /5.0/ in the URL to suit your version.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
MySQL Server

From novice to tech pro — start learning today.