Good morning everyone!
I want to do an SQL query that retrieves all the fields from the PRODUCT table whose id field is found in the SALES table, the SALES table has the following fields: ProductID, idVenta, Observation and the table PRODUCT has idProduct, price, description .
The query I've thought about is:
SELECT *
FROM 'producto'
WHERE 'idProducto'=
(SELECT idProducto
FROM 'ventas'
WHERE 'idProducto'=6)
Testing it in phpMyAdmin gives me the error that the subquery has several records, how can you make a query of this type? Is using JOIN
?
Thank you very much