随笔分类 -  sql

摘要:if OBJECT_ID('tempdb..#temp') is not null drop table #temp select * into #temp from ( --select * from Activity select 7 as 'month',25 as 'day' union all select 7 as 'month',25 as 'day'... 阅读全文
posted @ 2017-07-29 10:01 沉迷编程的程序员 阅读(2934) 评论(0) 推荐(0)
摘要:今天的所有数据:select * from 表名 where DateDiff(dd,datetime类型字段,getdate())=0 昨天的所有数据:select * from 表名 where DateDiff(dd,datetime类型字段,getdate())=1 7天内的所有数据:sel 阅读全文
posted @ 2017-07-28 14:53 沉迷编程的程序员 阅读(1925) 评论(0) 推荐(0)
摘要:这是执行前和执行后想要的效果 以下是用Sql语句实现的代码: 下面这个则是用Linq实现的代码: 阅读全文
posted @ 2017-06-28 10:29 沉迷编程的程序员 阅读(2584) 评论(0) 推荐(0)