mysql - Select unique rows after union query -


have query:

(select status, cb_ebook, product_id, titel, auther, image oc_product status , cb_ebook , titel '%term%')  union                (select status, cb_ebook, product_id, titel, auther, image oc_product status , cb_ebook , auther '%term%') 

however, there duplicatie rows in result, want unique product_id - tried group product_id not work.

any solutions ?

you can try adding distinct after union query, example?

select distinct(x.status) status,x.cb_ebook,x.product_id,x.titel,x.auther,x.image ( (select status, cb_ebook, product_id, titel, auther, image oc_product status , cb_ebook , titel '%term%') union (select status, cb_ebook, product_id, titel, auther, image oc_product status , cb_ebook , auther '%term%') ) x 

Comments

Popular posts from this blog

How to run C# code using mono without Xamarin in Android? -

c# - SharpSsh Command Execution -

python - Specify path of savefig with pylab or matplotlib -