SQL
IIIThSoul
这个作者很懒,什么都没留下…
展开
-
根据时间比较选择数据
declare @start datetime; set @start='2013/8/5'; select * from data_XiBaoZLSQB where datediff(d,@start,RiQi)>=0原创 2013-08-12 15:09:26 · 520 阅读 · 0 评论 -
多条SQL语句同时执行方法
SELECT * FROM table1;SELECT * FROM table2;SELECT * FROM table3;原创 2013-08-12 14:46:30 · 853 阅读 · 0 评论 -
SQL查询不重复数据
方法一:Distinct SELECT DISTINCT ColName FROM TableName方法二:Group By SELECT ColName FROM TableName GROUP BY ColName 更多内容: 查询并统计该字段的数量 SELECT ColName,COUNT(COlName) FROM TableName GROUP B原创 2013-08-15 09:11:22 · 1030 阅读 · 0 评论 -
SQL查询记录总数
SELECT COUNT(*) FROM TableName原创 2013-08-15 09:12:29 · 5121 阅读 · 1 评论 -
联表查询
declare @start datetime; set @start = '2013/07/01'; SELECT a.XingMing,b.YiYuanMC,a.RiQi FROM data_XiBaoZLSQB as a LEFT JOIN BaseInfo_YiYuanXXB as b ON a.YiYuanMC_id=b.YiYuanBH WHERE datediff(d,@start,原创 2013-09-30 13:43:17 · 408 阅读 · 0 评论