Skip to content
Advertisement

Unknown column ‘r’ in field list

I’ve been working on a SQL query for a project, and I face an error message when I want to use it.

Here is the query itself :

MySQL answers me “Unknown column ‘r’ in field list”.

But I dont really understand why I get an error here as I define r in my INNER JOIN.

I’m kinda new at using SQL so maybe there is something pretty obvious I forgot, but I can’t seem to understand what.

Advertisement

Answer

You can’t count an alias itself, so the very first line of your query is what is causing the error:

To remedy this, you could use COUNT(*):

Or, you could count an actual column in the smart_calculator_result table, e.g.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement