如何编写sql语句? [英] How to write the sql statement?

查看:83
本文介绍了如何编写sql语句?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





i有如下表格,

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




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..

推荐答案

尝试与类似的东西选择不同的TI_DATA,其中TI_time介于7/2/2012 11:07之间:上午48点和7月2日上午11:09:28


您好,您可以使用





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


这篇关于如何编写sql语句?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆