I have a problem with a query, initially very easy.
I created a table control_de_stock
where is the information of the stock of thousands of articles, each of them with its "id producto"
. I created another table ordenes_de_venta
where there is also "id producto"
and that is responsible for recording each sale that has been made.
I want to be able to find out what products have never been sold. For this I made this query. Separately I see that in stock control there are many more IDs than in order_of_sales, but nevertheless when executing the query it shows 0 rows.
select distinct "id producto" from control_de_stock
where "id producto" not in
(select distinct "id producto" from ordenes_de_venta);
Apart from the solution I would like to know what I am doing wrong or an explanation of why this is happening to me.
Thank you.