1

I only need Date where they are not repeated like:

    Date           Quantity
    2017-06-20     9
    2017-08-18     88
    2017-06-21     30

So I tried:

select CONVERT(date, UpdatedDate) as 'Date', COUNT(*) as 'Flights Quanttity'
from FlightSchedules
group by UpdatedDate

but I get something like:

Date           Quantity
2017-08-08     1
2017-06-20     1
2017-08-18     88
2017-06-20     16
2017-06-20     8

Because the date have hours it show the dates repeated, like the convert is just an output transformation, its counting the hours of that day separated, but I need to count flights for day with any hour on Quantity.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Vainx507
  • 11
  • 2

1 Answers1

4

Use

group by CONVERT(date, UpdatedDate)

Instead of :

group by UpdatedDate
Ali Adlavaran
  • 3,697
  • 2
  • 23
  • 47