user2196987
user2196987

Reputation: 13

SQL sub query date issue

The issue I am having is massively basic all I'm trying to do it use the following SQL code

SELECT *
FROM [Car For Sale]
WHERE CFS_Selling_Price IN (SELECT MAX (CFS_Selling_Price)
                            FROM [Car For Sale] 
                            HAVING CFS_Status ='Sold');

which works already along with the following SQL code

CFS_Sold_Date > dateadd("m",-1,date())

in order to reduce the results from the most expensive car sold to the most expensive car sold this month. I've tried figuring it out for myself to no avail anyone able to help ?

Upvotes: 1

Views: 66

Answers (1)

Fionnuala
Fionnuala

Reputation: 91376

Do you mean:

SELECT *
FROM [Car For Sale]
WHERE CFS_Selling_Price IN 
   (SELECT MAX (CFS_Selling_Price)
    FROM [Car For Sale] 
    WHERE CFS_Status ='Sold'
    AND CFS_Sold_Date > dateadd("m",-1,date()));

Upvotes: 1

Related Questions