Home > Database > Mysql Tutorial > body text

sql script: Calculating Days

WBOY
Release: 2016-06-07 17:43:32
Original
1295 people have browsed it

T1 (ID INTEGER ) T1 VALUES ( 1 ) x(dy,dm,mth,dw,wk) 7 as ( 8 select dy, 9 day (dy) dm, 10 datepart (m,dy) mth, 11 datepart (dw,dy) dw, (dw,dy)(ww,dy) (ww,dy) 15 end wk 16 from ( (, getdate ()) dy 18 from t1 19 ) x (d, 1 ,dy), day ( dateadd

T1 (ID INTEGER) T1 VALUES (1) x(dy,dm,mth,dw,wk) 7 as( 8 select dy, 9 day(dy) dm, 10 datepart(m,dy) mth, 11 datepart(dw,dy) dw, (dw,dy)(ww,dy)(ww,dy) 15 end wk 16 from( (,getdate()) dy 18 from t1 19 ) x (d,1,dy),day(dateadd(d,1,dy)),mth, 22 datepart(dw,dateadd(d,1,dy)), (dw,(wk,(wk,dateadd(d,1,dy)) x (m,dateadd(d,1,dy))=mth 29 ) (dm end) as Mo, dm end) as Tu, dm end) as We, dm end) as Th, dm end) as Fr, dm end) as Sa, dm end) as Su 37 from x wk wk dy, 43 day(dy) dm, 44 datepart(m,dy) mth, 45 datepart(dw,dy) dw, (dw,dy)(ww,dy)(ww,dy) 49 end wk 50 from( (,getdate()) dy 52 from t1 53 ) x x(dy,dm,mth,dw,wk) 58 as( 59 select dy, 60 day(dy) dm, 61 datepart(m,dy) mth, 62 datepart(dw,dy) dw, (dw,dy)(ww,dy)(ww,dy) 66 end wk 67 from( (,getdate()) dy 69 from t1 70 ) x (d,1,dy), day(dateadd(d,1,dy)),mth, 73 datepart(dw,dateadd(d,1,dy)), (dw,(wk,(wk,dateadd(d,1,dy)) x (m,dateadd(d,1,dy))=mth 80 ) x ,网站空间,网站空间,网站空间

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template