SajjadZare SajjadZare - 1 year ago 61
SQL Question

Write query for this example

I have a table with below data,I want to write a query that give me id and the number of days that have connection.

For example for id 1 give me 2 times (2016-09-20 , 2016-09-22)

enter image description here

Answer Source
SELECT id, COUNT(DISTINCT convert(date, startTime)) as noOfDays
FROM your_table