• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
一个具有上进心的码农
因为一篇文章中有很多是从很多篇文章中摘取的,请恕我没有一一说明摘取出处,如果没有说明,则该文章默认是摘取,如有侵犯您的权益,请与我联系,将会马上删除。
博客园    首页    新随笔    联系   管理    订阅  订阅

SQL查询排序,自我比较,启动程序

    System.Diagnostics.Process.Start(@"D:\FoxMail\Foxmail.exe");

select *
from MonthlyEnterpriseMonitor
where cast([Year] AS nvarchar(10))+'-0'+cast([Month] AS nvarchar(10))+'-01 00:00:00'
between '2009-01-01 00:00:00' and '2009-02-28 23:59:59'


declare @t table(id int,   name varchar(10),   Time1 datetime,     Time2 datetime)
insert @t select 1,'AA','2008-5-10','2009-1-1'
insert @t select 2,'AA','2008-11-5',null
insert @t select 3,'BB','2008-5-10','2009-2-14'
insert @t select 4,'BB','2008-8-23','2009-1-5'
insert @t select 5,'BB','2008-9-14','2009-4-1'
insert @t select 6,'CC','2009-2-22',null
insert @t select 7,'CC','2008-10-10','2009-1-10'

select * from @t t where not exists(select 1 from @t where name=t.name and (time1>t.time1 or time2>t.time2))

/*
id          name       Time1                   Time2
----------- ---------- ----------------------- -----------------------
2           AA         2008-11-05 00:00:00.000 NULL
5           BB         2008-09-14 00:00:00.000 2009-04-01 00:00:00.000
6           CC         2009-02-22 00:00:00.000 NULL

(3 行受影响)
*/

 

http://www.cikuu.com/contact.html


select * from dbo.T_Question

where (tag like N'%卡%充积分%' and tag  not like N'%充积分%')

or (tag not like N'%卡%充积分%' and tag  like N'%充积分%')

posted @ 2009-04-08 12:04  不若相忘于江湖  阅读(265)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3