易截截图软件、单文件、免安装、纯绿色、仅160KB

sql server常用语句

1、按时间排序
select * from tbl_lms_loginhistory  order by loginhistory_logintime desc
2、
  
在一个数据库中是下列的样子
车次 身份证号
27 1
27 2
45 1
25 1
45 2
现在我想 获得的是
车次 乘坐次数
25 1
27 3
45 2
请问,我的SQL语句该怎么写?
select 车次,sum(身份证号)as 乘坐次数 from 表名 group by 车次
3、count与distinct
select count(*) from tbl_lms_loginhistory
select count(distinct loginhistory_emp_fk) from tbl_lms_loginhistory


相关文档:

Linq to SQL Like Operator(转载)


As a response for customer's question, I decided to write about using Like Operator in Linq to SQL queries.
Starting from a simple query from Northwind Database;
var query = from c in ctx.Customers
            where c.City == "London"
&nbs ......

SQL 取n到m条记录

1.
select   top   m   *   from   tablename   where   id   not   in   (select   top   n   id   from   tablename)
2.
select   top & ......

SQL中CONVERT转化函数的用法

格式:
CONVERT(data_type,expression[,style])
说明:
此样式一般在时间类型(datetime,smalldatetime)与字符串类型(nchar,nvarchar,char,varchar)
相互转换的时候才用到.
例子:
SELECT CONVERT(varchar(30),getdate(),101) now
结果为:
now
---------------------------------------
|09/15/2001
===== ......

SQL Server事务日志揭秘

事务日志里面“藏”着很多有用的信息。虽然SQL Server本身并没有提供分析工具,但是我们可以使用第三方工具来一探究竟。
Red Gate软件提供了一款叫做SQL Log Rescue的免费工具,但是只支持SQL Server 2000。ApexSQL和Lumigent公司提供的两款软件分别叫做ApexSQL Log和Log Explorer,它们支持SQL Server7、2000和 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号