I have a table where I have some records as follows
Model Make Color
==================================================
Maruti 800 2008 Black
Maruti 800 2009 White
Maruti Esteem 2000 Yelow
Maruti Esteem 2010 Red
Now I want the Model, Make and Color which has maximum make in the list.
I have tried writing query like this
SELECT
Model,
MAX(Model),
Color
from
tableName
GROUP BY
Model,
Color
But the result are not coming which I would like
It should be like
Model Make Color
===================================================
Maruti 800 2009 White
Maruti Esteem 2010 Red
But the result is the whole table.
I need only those record which has max Make Model Wise.
I have also tried inner Query (co-related query) But in that also it is asking for group by.
The query below supports on all RDBMS including
MySQL,Oracle,SQL Server,…if your RDBMS supports windows function,
or