1

I have 3 tables (provider, provider_has_product, product): enter image description here

(Original here: http://content.screencast.com/users/Maksold/folders/Jing/media/4e6de435-eeac-4602-95e0-2a1b0b4876ad/2012-01-18_0851.png)

I tried division operation by this code:

SELECT DISTINCT `provider_has_product`.`provider_id` FROM `provider_has_product` WHERE NOT EXIST
 (SELECT * FROM `product` WHERE NOT EXIST
  (SELECT * FROM `provider_has_product` A1 WHERE 
     A1.`provider_id` = `provider_has_product`.`provider_id` AND
     A1.`product_id` = `product`.`id`))

But it dosn't work. It shows: Error Code: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT * FROMproductWHERE NOT EXIST (SELECT * FROMprovider_has_p' at line 2`

How make division on MySQL and correct this error.

Maksold
  • 61
  • 1
  • 7

1 Answers1

3

Check for a typo. I'm pretty sure it's EXISTS, not EXIST

Sergio Tulentsev
  • 226,338
  • 43
  • 373
  • 367