Skip to content
Advertisement

How to Join & Groupby in SQL?

I am running the following command in Oracle SQL Developer:

But I am getting this error:

Advertisement

Answer

Your select columns don’t match the group by — you have two unaggregated columns in the select and only one in the group by. Presumably, you want either:

Or more likely:

Notes:

  • Never use commas in the FROM clause. Always use proper, explicit, standard, readable JOIN syntax.
  • Table aliases make the query easier to write and to read.
  • order is a really bad name for a table because it is a SQL keyword.
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement