| 订阅 | 在线投稿
分享
 
 
当前位置: 王朝网络 >> delphi >> gen ri qi you guan de liang tiao jing dian SQL yu ju

gen ri qi you guan de liang tiao jing dian SQL yu ju

2006-12-17 07:41:10 编辑來源:互联网 评论
 
 
 
本文为【跟日期有关的两条经典SQL语句】的拼音翻译版
  gen ri qi you guan de liang tiao jing dian SQL yu ju
  
  gen ri qi you guan de liang tiao jing dian SQL yu ju 1. yong yi tiao yu ju de chu mou ri qi suo zai yue fen de zui da tian shu ?SELECT DAY(DATEADD(dd, -DAY('2004-02-13'), DATEADD(mm, 1, '2004-02-13'))) AS 'Day Number'
  2. shao ji lu bian cheng duo tiao ji lu wen ti
  you biao tbl
  ri qi shou ru zhi chu
  2004-02-11 00:00:00 60 45
  2004-03-01 00:00:00 60 45
  2004-03-02 00:00:00 40 50
  2004-03-05 00:00:00 50 40
  /*
  ce shi shu ju :
  Create Table tbl([ ri qi ] smalldatetime,[ shou ru ] int ,[ zhi chu ] int) Insert Into tbl
  SELECT '2004-02-11', 60, 45
  union SELECT '2004-03-01',60, 45
  union SELECT '2004-03-02',40, 50
  union SELECT '2004-03-05',50, 40
  */
  yao de dao de jie guo :
  ri qi shou ru zhi chu yu e
  2004-02-01 00:00:00 NULL NULL NULL
  2004-02-02 00:00:00 NULL NULL NULL
  2004-02-03 00:00:00 NULL NULL NULL
  2004-02-04 00:00:00 NULL NULL NULL
  2004-02-05 00:00:00 NULL NULL NULL
  2004-02-06 00:00:00 NULL NULL NULL
  2004-02-07 00:00:00 NULL NULL NULL
  2004-02-08 00:00:00 NULL NULL NULL
  2004-02-09 00:00:00 NULL NULL NULL
  2004-02-10 00:00:00 NULL NULL NULL
  2004-02-11 00:00:00 60 45 15
  2004-02-12 00:00:00 NULL NULL 15
  2004-02-13 00:00:00 NULL NULL 15
  2004-02-14 00:00:00 NULL NULL 15
  2004-02-15 00:00:00 NULL NULL 15
  2004-02-16 00:00:00 NULL NULL 15
  2004-02-17 00:00:00 NULL NULL 15
  2004-02-18 00:00:00 NULL NULL 15
  2004-02-19 00:00:00 NULL NULL 15
  2004-02-20 00:00:00 NULL NULL 15
  2004-02-21 00:00:00 NULL NULL 15
  2004-02-22 00:00:00 NULL NULL 15
  2004-02-23 00:00:00 NULL NULL 15
  2004-02-24 00:00:00 NULL NULL 15
  2004-02-25 00:00:00 NULL NULL 15
  2004-02-26 00:00:00 NULL NULL 15
  2004-02-27 00:00:00 NULL NULL 15
  2004-02-28 00:00:00 NULL NULL 15
  2004-02-29 00:00:00 NULL NULL 15
  2004-03-01 00:00:00 60 45 30
  2004-03-02 00:00:00 40 50 20
  2004-03-03 00:00:00 NULL NULL 20
  2004-03-04 00:00:00 NULL NULL 20
  2004-03-05 00:00:00 50 40 30
  2004-03-06 00:00:00 NULL NULL 30
  2004-03-07 00:00:00 NULL NULL 30
  2004-03-08 00:00:00 NULL NULL 30
  2004-03-09 00:00:00 NULL NULL 30
  2004-03-10 00:00:00 NULL NULL 30
  2004-03-11 00:00:00 NULL NULL 30
  2004-03-12 00:00:00 NULL NULL 30
  2004-03-13 00:00:00 NULL NULL 30
  2004-03-14 00:00:00 NULL NULL 30
  2004-03-15 00:00:00 NULL NULL 30
  2004-03-16 00:00:00 NULL NULL 30
  2004-03-17 00:00:00 NULL NULL 30
  2004-03-18 00:00:00 NULL NULL 30
  2004-03-19 00:00:00 NULL NULL 30
  2004-03-20 00:00:00 NULL NULL 30
  2004-03-21 00:00:00 NULL NULL 30
  2004-03-22 00:00:00 NULL NULL 30
  2004-03-23 00:00:00 NULL NULL 30
  2004-03-24 00:00:00 NULL NULL 30
  2004-03-25 00:00:00 NULL NULL 30
  2004-03-26 00:00:00 NULL NULL 30
  2004-03-27 00:00:00 NULL NULL 30
  2004-03-28 00:00:00 NULL NULL 30
  2004-03-29 00:00:00 NULL NULL 30
  2004-03-30 00:00:00 NULL NULL 30
  2004-03-31 00:00:00 NULL NULL 30
  da an :
  SELECT Y.[ ri qi ], tbl.[ shou ru ], tbl.[ zhi chu ], (
  SELECT SUM(ISNULL(tbl.[ shou ru ], 0)-ISNULL(tbl.[ zhi chu ], 0)) FROM tbl WHERE [ ri qi ]<=Y.[ ri qi ]) AS [ yu e ]
  FROM tbl RIGHT JOIN (
  SELECT DATEADD(dd, N.i, DATEADD(dd, 1-DAY(m.MinDay), m.MinDay)) AS [ ri qi ]
  FROM (
  SELECT 0 AS i
  UNION ALL SELECT 1
  UNION ALL SELECT 2
  UNION ALL SELECT 3
  UNION ALL SELECT 4
  UNION ALL SELECT 5
  UNION ALL SELECT 6
  UNION ALL SELECT 7
  UNION ALL SELECT 8
  UNION ALL SELECT 9
  UNION ALL SELECT 10
  UNION ALL SELECT 11
  UNION ALL SELECT 12
  UNION ALL SELECT 13
  UNION ALL SELECT 14
  UNION ALL SELECT 15
  UNION ALL SELECT 16
  UNION ALL SELECT 17
  UNION ALL SELECT 18
  UNION ALL SELECT 19
  UNION ALL SELECT 20
  UNION ALL SELECT 21
  UNION ALL SELECT 22
  UNION ALL SELECT 23
  UNION ALL SELECT 24
  UNION ALL SELECT 25
  UNION ALL SELECT 26
  UNION ALL SELECT 27
  UNION ALL SELECT 28
  UNION ALL SELECT 29
  UNION ALL SELECT 30
  UNION ALL SELECT 31
  ) N,
  (
  SELECT MIN( ri qi ) AS MinDay
  FROM tbl
  GROUP BY DATEDIFF(month, 0, ri qi )
  ) M
  WHERE DATEDIFF(mm, DATEADD(dd, N.i, DATEADD(dd, 1-DAY(m.MinDay), m.MinDay)), M.MinDay)=0) AS Y
  ON tbl.[ ri qi ]=Y. ri qi【原文】【汉音对照
 
 
 
 
 
 
 
 
 
日版宠物情人插曲《Winding Road》歌词

日版宠物情人2017的插曲,很带节奏感,日语的,女生唱的。 最后听见是在第8集的时候女主手割伤了,然后男主用嘴帮她吸了一下,插曲就出来了。 歌手:Def...

兄弟共妻,我成了他们夜里的美食

老钟家的两个儿子很特别,就是跟其他的人不太一样,魔一般的执着。兄弟俩都到了要结婚的年龄了,不管自家老爹怎么磨破嘴皮子,兄弟俩说不娶就不娶,老父母为兄弟两操碎了心...

如何磨出破洞牛仔裤?牛仔裤怎么剪破洞?

把牛仔裤磨出有线的破洞 1、具体工具就是磨脚石,下面垫一个硬物,然后用磨脚石一直磨一直磨,到把那块磨薄了,用手撕开就好了。出来的洞啊很自然的。需要猫须的话调几...

我就是扫描下图得到了敬业福和爱国福

先来看下敬业福和爱国福 今年春节,支付宝再次推出了“五福红包”活动,表示要“把欠大家的敬业福都还给大家”。 今天该活动正式启动,和去年一样,需要收集“五福”...

冰箱异味产生的原因和臭味去除的方法

有时候我们打开冰箱就会闻到一股异味,冰箱里的这种异味是因为一些物质发出的气味的混合体,闻起来让人恶心。 产生这些异味的主要原因有以下几点。 1、很多人有这种习...

 
 
gen ri qi you guan de liang tiao jing dian SQL yu ju gen ri qi you guan de liang tiao jing dian SQL yu ju 1. yong yi tiao yu ju de chu mou ri qi suo zai yue fen de zui da tian shu ?  SELECT DAY(DATEADD(dd, -DAY('2004-02-13'), DATEADD(mm, 1, '2004-02-13'))) AS 'Day Number'   2. shao ji lu bian cheng duo tiao ji lu wen ti    you biao tbl    ri qi shou ru zhi chu   2004-02-11 00:00:00 60 45   2004-03-01 00:00:00 60 45   2004-03-02 00:00:00 40 50   2004-03-05 00:00:00 50 40   /*    ce shi shu ju :   Create Table tbl([ ri qi ] smalldatetime,[ shou ru ] int ,[ zhi chu ] int)   Insert Into tbl   SELECT '2004-02-11', 60, 45   union SELECT '2004-03-01',60, 45   union SELECT '2004-03-02',40, 50   union SELECT '2004-03-05',50, 40   */    yao de dao de jie guo :    ri qi shou ru zhi chu yu e   2004-02-01 00:00:00 NULL NULL NULL   2004-02-02 00:00:00 NULL NULL NULL   2004-02-03 00:00:00 NULL NULL NULL   2004-02-04 00:00:00 NULL NULL NULL   2004-02-05 00:00:00 NULL NULL NULL   2004-02-06 00:00:00 NULL NULL NULL   2004-02-07 00:00:00 NULL NULL NULL   2004-02-08 00:00:00 NULL NULL NULL   2004-02-09 00:00:00 NULL NULL NULL   2004-02-10 00:00:00 NULL NULL NULL   2004-02-11 00:00:00 60 45 15   2004-02-12 00:00:00 NULL NULL 15   2004-02-13 00:00:00 NULL NULL 15   2004-02-14 00:00:00 NULL NULL 15   2004-02-15 00:00:00 NULL NULL 15   2004-02-16 00:00:00 NULL NULL 15   2004-02-17 00:00:00 NULL NULL 15   2004-02-18 00:00:00 NULL NULL 15   2004-02-19 00:00:00 NULL NULL 15   2004-02-20 00:00:00 NULL NULL 15   2004-02-21 00:00:00 NULL NULL 15 2004-02-22 00:00:00 NULL NULL 15   2004-02-23 00:00:00 NULL NULL 15   2004-02-24 00:00:00 NULL NULL 15   2004-02-25 00:00:00 NULL NULL 15   2004-02-26 00:00:00 NULL NULL 15   2004-02-27 00:00:00 NULL NULL 15   2004-02-28 00:00:00 NULL NULL 15   2004-02-29 00:00:00 NULL NULL 15   2004-03-01 00:00:00 60 45 30   2004-03-02 00:00:00 40 50 20   2004-03-03 00:00:00 NULL NULL 20   2004-03-04 00:00:00 NULL NULL 20   2004-03-05 00:00:00 50 40 30   2004-03-06 00:00:00 NULL NULL 30   2004-03-07 00:00:00 NULL NULL 30   2004-03-08 00:00:00 NULL NULL 30   2004-03-09 00:00:00 NULL NULL 30   2004-03-10 00:00:00 NULL NULL 30   2004-03-11 00:00:00 NULL NULL 30   2004-03-12 00:00:00 NULL NULL 30   2004-03-13 00:00:00 NULL NULL 30   2004-03-14 00:00:00 NULL NULL 30   2004-03-15 00:00:00 NULL NULL 30   2004-03-16 00:00:00 NULL NULL 30   2004-03-17 00:00:00 NULL NULL 30   2004-03-18 00:00:00 NULL NULL 30   2004-03-19 00:00:00 NULL NULL 30   2004-03-20 00:00:00 NULL NULL 30   2004-03-21 00:00:00 NULL NULL 30   2004-03-22 00:00:00 NULL NULL 30   2004-03-23 00:00:00 NULL NULL 30   2004-03-24 00:00:00 NULL NULL 30   2004-03-25 00:00:00 NULL NULL 30   2004-03-26 00:00:00 NULL NULL 30   2004-03-27 00:00:00 NULL NULL 30   2004-03-28 00:00:00 NULL NULL 30   2004-03-29 00:00:00 NULL NULL 30   2004-03-30 00:00:00 NULL NULL 30   2004-03-31 00:00:00 NULL NULL 30    da an :   SELECT Y.[ ri qi ], tbl.[ shou ru ], tbl.[ zhi chu ], (   SELECT SUM(ISNULL(tbl.[ shou ru ], 0)-ISNULL(tbl.[ zhi chu ], 0)) FROM tbl WHERE [ ri qi ]<=Y.[ ri qi ]) AS [ yu e ]   FROM tbl RIGHT JOIN (   SELECT DATEADD(dd, N.i, DATEADD(dd, 1-DAY(m.MinDay), m.MinDay)) AS [ ri qi ]   FROM (   SELECT 0 AS i   UNION ALL SELECT 1   UNION ALL SELECT 2   UNION ALL SELECT 3   UNION ALL SELECT 4   UNION ALL SELECT 5   UNION ALL SELECT 6   UNION ALL SELECT 7   UNION ALL SELECT 8   UNION ALL SELECT 9   UNION ALL SELECT 10   UNION ALL SELECT 11   UNION ALL SELECT 12   UNION ALL SELECT 13   UNION ALL SELECT 14   UNION ALL SELECT 15   UNION ALL SELECT 16   UNION ALL SELECT 17   UNION ALL SELECT 18   UNION ALL SELECT 19   UNION ALL SELECT 20   UNION ALL SELECT 21   UNION ALL SELECT 22   UNION ALL SELECT 23   UNION ALL SELECT 24   UNION ALL SELECT 25   UNION ALL SELECT 26   UNION ALL SELECT 27   UNION ALL SELECT 28   UNION ALL SELECT 29   UNION ALL SELECT 30   UNION ALL SELECT 31   ) N,   (   SELECT MIN( ri qi ) AS MinDay   FROM tbl   GROUP BY DATEDIFF(month, 0, ri qi )   ) M   WHERE DATEDIFF(mm, DATEADD(dd, N.i, DATEADD(dd, 1-DAY(m.MinDay), m.MinDay)), M.MinDay)=0) AS Y   ON tbl.[ ri qi ]=Y. ri qi
󰈣󰈤
  免责声明:本文仅代表作者个人观点,与王朝网络无关。王朝网络登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述,其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
清凉一夏_清纯美丽
纯白色小礼服
靓丽可人儿_嘉嘉
我的女神_靓丽女生
主题摄影
贵州,让我欢喜,让我神伤。
莫干山
天平秋色
 
>>返回首页<<
 
 
 为你推荐
 
 
 
 转载本文
 UBB代码 HTML代码
复制到剪贴板...
 
 热帖排行
 
 
 
 
 
©2005- 王朝网络 版权所有