TI_DEVICEID TI_DATA TI_TIME ---------- ------- ------- ST0001 DT906DT906 7/2/2012 11:07:48 AM ST0001 DT906DT900DT906DT900 7/2/2012 11:08:28 AM ST0001 DT906DT900DT914 7/2/2012 11:09:28 AM
In which TI_DATA column contains the id of students in a vehicle at each time. Then how to query the table to find the count of distinct id from TI_DATA from 7/2/2012 11:07:48 AM to 7/2/2012 11:09:28 AM?
select distinct TI_DATA where TI_time between 7/2/2012 11:07:48 AM and 7/2/2012 11:09:28 AM
Select TI_DATA, Count(TI_DATA) as Count_TI_DATA from your Table name group by(TI_DATA) TI_TIME between '7/2/2012' and '7/2/2012' it gives output TI_DATA Count_TI_DATA DT906DT906 4
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)