How To Use Like Keyword In Group By Clause. Mysql

Hey

I executed a query and got table like this:-

query=select column_1, column_2 from @Table_name where id in (818, 1213, 114)

table:-

column_1 | column_2


vinod | Agarwal

vinod | Agarwal

vinod kr. | Agarwal

If I change query like this

select column_1, column_2 from @Table_name where id in (818, 1213, 114) group by column_1, column_2

then I got as

column_1 | column_2


vinod | Agarwal

vinod kr. | Agarwal

but I want only one record in my resultant table. Any solution for this. Thanx

Why don’t you use limit 1 ?

It’s not quite clear what are you trying to do.

If you want only one record, you should either get rid of IN(…), or use appropriate aggregate.

Obviously "group by column_1, column_2" is wrong choice.