Jump to content

Query prodotti senza immagine


Recommended Posts

Ci sono 2 modi:

1) con LEFT JOIN

SELECT p.id_product 
FROM ps_product p 
LEFT JOIN ps_image i on i.id_product = p.id_product
WHERE i.id_product IS NULL

2) con una subquery

SELECT id_product FROM ps_product WHERE id_product NOT IN (SELECT id_product FROM ps_image);

 

Con grandi moli di dati il secondo metodo è più performante.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...