first table : "wp_pc_products"
feed_product_name feed_product_image price deeplink id_merchant
sony xperia c3 abc.png 12000 abc.html fkt
sony xperia xyz.png 11000 aaa.html snd
sony xperia M pqr.png 10000 bbb.html fkt
second table: "wp_pc_products_merchants"
slug image
fkt logo1.png
snd logo2.png
My existing query
select p.feed_product_name,p.feed_product_image,p.price,p.deeplink,p.id_merchant,m.image
from wp_pc_products p
JOIN wp_pc_products_merchants m ON m.slug=p.id_merchant
and (feed_product_name like'%sony%' or feed_product_name like'%xperia%'
or feed_product_name like'%c3%' ) and price BETWEEN "11829.3" and "21968.7"
result O/P
feed_product_name feed_product_image price deeplink id_merchant image
sony xperia c3 abc.png 12000 abc.html fkt logo1.png
sony xperia xyz.png 11000 aaa.html snd logo2.png
sony xperia M pqr.png 10000 bbb.html fkt logo1.png
By using above join query i got the output that i require, but look at the image column in O/P. As per my query "logo1.png" is repeated two times instead of that i want to show only first two records only, for that i use group by clause in above query but when i use group by the query doesn't show me any output. please tell me on which column i use group by clause in above query. please suggest me the best.