Select min(date), max(date) and group by day from one column - SQL Select min(date), max(date) and group by day from one column - SQL sql-server sql-server

Select min(date), max(date) and group by day from one column - SQL


Convert the column in the GROUP BY as well.

select  min(datum), max(datum), CONVERT(varchar(8), datum, 112)from  dateTablegroup by   CONVERT(varchar(8), datum, 112)

Here is a fiddle

Here are the list of convert values for dates. (I've chosen 112 for you in this case above)


In SQL Server 2008+, you can use the date data type instead of converting to a character string:

select cast(datum as date), min(datum), max(datum) from myTablegroup by cast(datum as date);