0

I have a table called items where I store items . Many of the item have same name but different barcode and item_id . How can I get all the rows from items table which has a same name . I want something like this as a result

Item1 , .. 24 ,....97982828282
Item1 ,.... 34 , .....987829286
Item3 ,.... 44 , .....987829284
Item3 ,.... 54 , .....987829280

1 Answers1

0
SELECT t1.*
FROM table t1
WHERE EXISTS ( SELECT NULL
               FROM table t2
               WHERE t1.name = t2.name
                 AND ( t1.barcode != t2.barcode
                       OR
                       t1.item_id != t2.item_id )
             );
Akina
  • 39,301
  • 5
  • 14
  • 25