摘要: 表结构如下:相关查询:--所有数据中通话时间最长的5条记录select top 5 * from CallRecords1 order by dateDiff(second,StartDateTime,EndDateTime) desc--输出所有数据中拨打长途号码(对方号码以0开头)的总时长。like,sumselect sum(dateDiff(second,StartDateTime,EndDateTime)) from CallRecords1 where TelNum like '0%'--输出本月拨打电话次数最多的前三个呼叫员的编号select * from Cal 阅读全文
posted @ 2011-06-16 22:43 草珊瑚 阅读(712) 评论(0) 推荐(0) 编辑
摘要: 表link1数据:ida12表link2数据:idb23查询语句如下: --内连接select * from link1 a join link2 b on a.ida=b.idbida idb ----------- ----------- 2 2 --左连接select * from link1 a left join link2 b on a.ida=b.idbida idb ----------- ----------- 1 NULL 2 2 --右连接select * from link1 a right join link2 b on a.ida=b.idbida idb ---- 阅读全文
posted @ 2011-06-16 10:31 草珊瑚 阅读(1136) 评论(0) 推荐(1) 编辑
摘要: 花了两天时间,参考别人写好,首先表数据如下:直接上代码:usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Web;usingSystem.Web.UI;usingSystem.Web.UI.WebControls;usingSystem.Data;usingSystem.Data.SqlClient;usingSystem.Configuration;publicpartialclasslearnFenye:System.Web.UI.Page{SqlConnectionsqlconn;protec 阅读全文
posted @ 2011-06-16 09:05 草珊瑚 阅读(557) 评论(0) 推荐(0) 编辑