0

I am trying to compare product_models in a product table between 2 different manufacturers. I found the same product has 2 different product_model numbers. Similar but still different. For example CNELD-1004 from Manufacturers 1 (ELD) is the same product as 1004 from Manufacturers 2 (MC). I am trying to show the products from Manufacturers 2 where it is NOT like the same product_model from Manufacturers 1

Without using php, is there a way to do this mysql?

select products_model  AS MCProducts from products where manufacturers_id = 2; 

select products_model  AS ELDProducts from products where manufacturers_id = 1; 

Select  MCProducts from products WHERE MCProducts  not LIKE  "%ELDProducts%"
Raidri
  • 17,258
  • 9
  • 62
  • 65
kipper
  • 1
  • 2

2 Answers2

0

select products_model, CASE

  WHEN manufacturers_id = 2 THEN 'MCProducts' 
  WHEN manufacturers_id = 2 THEN 'ELDProducts'
  END 
from products where WHERE MCProducts  not LIKE  "%ELDProducts%"
Community
  • 1
  • 1
0

I guess this will also work.

select products_model  AS MCProducts from products where manufacturers_id = 2 and     products_model not in (select products_model  from products where manufacturers_id = 1);
Survivor - 2012
  • 300
  • 4
  • 19