Skip to content
Advertisement

get most frequent values in every month in 2021

Trying to get the most frequent values in every month from tables

inspection table :

can be ignored – > FOREIGN key (lno) REFERENCES restaurant)

data :

query :

output:

month id
3 333
4 222
5 222
6 333

expected output –

month id
3 333
4 222
5 111
6 222
6 333

Advertisement

Answer

IMHO you don’t need the inspector table for this calculation. A query like this would do:

Here is Dbfiddle demo link.

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