I have a customer table (id, name, surname) and an order table (id, quantity, date, customer_id), how can I get the data of the customer who made the cheapest order on a given date? I can't use INNER JOIN, only subqueries. If I use the MAX(amount) in the SELECT I get a figure, but I need it to return all the fields so that I can then compare the customer id.
Edit to put what I'm trying. The code has to be with nested queries, and my mental block has led to this horror:
SELECT *
FROM cliente c
WHERE c.id=(SELECT pedido.id_cliente
FROM pedido
WHERE (SELECT MIN(cantidad)
FROM pedido
WHERE (SELECT *
FROM pedido
WHERE year(fecha)=1999
)
)
);