sql - TSQL query that would return me the earliest date and the latest date in a table -
I have a table in the SQL Server 2008 database that contains the records column along with the date column. When a new entry is in the table, the date is automatically entered. Therefore, there is a record date which has been made which has been created.
I am trying to run a query that will return the oldest date and latest date in this table.
I tried to do something like that;
SELECT TOP (1) added date order order date from the first date added DESC; SELECT TOP (1) Ascending date from date end date as added by date order; But this has only returned the 'FirstDate'.
How can someone achieve this goal?
SELECT MIN (date added) as the first date, Max (added date) Last date from the news;
Comments
Post a Comment