Reputation: 2311
I've query which will return distinct date from column [InsertDate]
SELECT DISTINCT [InsertDate] FROM cust
Now I want to get max date from the result returned by the query. Here the query, but it didn't work
SELECT max(SELECT DISTINCT [InsertDate] FROM cust) from cust
Example: 2015-12-01 2016-01-01
Result: 2016-01-01
Upvotes: 0
Views: 940
Reputation: 6693
you can use below query
SELECT max(InsertDate)
FROM (select DISTINCT InsertDate FROM cust) k
the question is why don't you just simply use below?
select max(InsertDate) FROM cust
Upvotes: 2