0

How to use group by clause in sub query?

2nd Sep 2016, 2:26 PM
Kirtiranjan Sahoo
Kirtiranjan Sahoo - avatar
4 Answers
+ 3
When using sub query make sure you use the same column name as mentioned in group by. Otherwise it will throw an error. You could use scalar function like avg, max.. Etc in select clause Example Select * from Tablename where id in ( select id from idtable group by id having count(id) >2.
3rd Sep 2016, 12:26 PM
Akilan Mc
Akilan Mc - avatar
+ 1
just in the same way that we use on the queries
2nd Sep 2016, 4:54 PM
Luis Arce
Luis Arce - avatar
0
select * from table_name where attribute_name in (select *from table_name where condition group by attribute_name)
2nd Sep 2016, 4:01 PM
Sunil M E
0
Use same as normal
27th Feb 2017, 6:05 PM
Birender Rana
Birender Rana - avatar