jeudi 16 juin 2016

Nested SQL query using three tables

I got three tables:

Article_Size_Class

  • Article_ID
  • Size_Class

Sizes_not_availabe

  • Size_Class
  • Size_ID

Size_Table

  • Size_ID
  • Length

So I got an Article_ID and now I want to list all the available product lengths from my Size_Table expect the ones listed in the Sizes_not_availabe table.

I tried to do this, but unfortunately it is not working:

SELECT *
FROM Size_Table
WHERE NOT EXISTS
(
SELECT Size_ID
FROM Sizes_not_availabe
LEFT JOIN Article_Size_Class
ON Article_Size_Class.Size_ID = Article_Size_Class.Size_ID
WHERE Article_Size_Class.Article_ID= '00024-002'
)

Thanks for helping!

Aucun commentaire:

Enregistrer un commentaire