Hi every body
any body can help me to get the max record for a forien key
I have two tables
customer (ID, … info)
and Bills (ID, Customer_id, Info)
I want to get a customer information and the last bill record
I write this query
select c.id,c.info, b.info from customer c
JOIN (
SELECT *
FROM Bills
WHERE id=(SELECT MAX(id) FROM Bills where customer_id = 1)
) as b
ON b.customer = c.id
where c.id=1
is there any way to customize this query ?