MySQL - Show duplicated data from columns in different tables, when only one column is duplicated -


i have such query shows me nicely product.model duplicated:

select product.model, product_description.name, count( * ) count product, product_description product.product_id = product_description.product_id group product.model order count having count >1 

however can't force query show content of product_description.name every duplicated product.model , compare product_description.name

i trying make in on result, '#1241 - operand should contain 1 column(s)'. idea how can process result further?

depending on desired results, if want see models have more 1 record in the product table, , want see associated product descriptions, use group_concat combine descriptions.

select p.model, group_concat(pd.name), count( 1 ) count product p   inner join product_description pd using (product_id) group p.model having count(1) > 1 order 3 

sql fiddle demo

there other ways return in different rows, depends on needs.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -