I have two tables :First one has Customer specification :CUSTOMER ====================ID - Name - city - tel - addressThe second is the history of sellingSELL======================ID - CustomerID - Date i want to write a query to show the customers which has no bought before special date, and show the last date of boughtI wrote this query but it shows the max(date)=null select Customer.Name ,Customer.city ,Customer.tel ,Customer.address,max(Sell.Date) as 'date' from Sell right join Customer on Sell.CustomerID = Customer.ID group by Sell.CustomerID,Customer.Name,Customer.ID ,Customer.city ,Customer.tel,Customer.addresshaving max(Date)< '2013/03/01'