Click here to Skip to main content
15,886,075 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

i have a table as below,
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

SQL
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?



thanks..
Posted
Updated 18-Jan-13 19:54pm
v3

Try something similar to select distinct TI_DATA where TI_time between 7/2/2012 11:07:48 AM and 7/2/2012 11:09:28 AM.
 
Share this answer
 
Comments
hasbina 19-Jan-13 1:57am    
No.Read question
Hello Simply You can use


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
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900