Summary of asp access date operation statements by stabx

Source: Internet
Author: User

CopyCode The Code is as follows: 13.5.1 list the data of a day and a week
Select distinct dateandtime
From ctdate_by_query_date
Where dateandtime between (#2006-5-15 # + (weekday (2006-5-15)-7)-6) and (#2006-5-15 #-7) + weekday (2006-5-15)
SQL = "select distinct dateandtime from ctarticle where dateandtime between (#" & Date & "# + (weekday (" & Date & ")" & norp & "7 )) -6) and (# "& Date &" # "& norp &" 7) + weekday ("& Date &")"
13.5 query the data of all days of a day in the week
Select *
From ctdate_by_query_date
Where dateandtime between (#2006-5-15 # + weekday (2006-5-15)-6) and #2006-5-15 # + weekday (2006-5-15)

13.4 query a time period
Select *
From ctdate_by_query_date
Where dateandtime between #2006-5-1 # And #2006-5-30 #

13.3.2 list the years of different years, and do not use the same
Select distinct year (dateandtime) from ctarticle
The result is as follows:
Expr1000
2000
2003
2004
2005
2006

13.3.1 list the first record of the previous year on a certain day
Select top 1 dateandtime from ctarticle where year (dateandtime) = (2006)-1
SQL = "select top 1 dateandtime from ctarticle where year (dateandtime) = (Year (#" & Date & "#)" & norp

13.3 list data of a year
SQL = "select * From ctdate_by_query_date where year (dateandtime) =" & year (rqqdt _) & "order by dateandtime DESC"

13.2.1 search for the first record in January
Select top 1 dateandtime from ctarticle where year (dateandtime) = year (#2006-5-28 #) and month (dateandtime) = month (#2006-5-28 #)-1

13.2 list data of a month
SQL = "select * From ctdate_by_query_date where year (dateandtime) =" & year (rqqdt _) & "and month (dateandtime) =" & month (rqqdt _) & "order by dateandtime DESC"

13.1 list data of a day
SQL = "select * From ctdate_by_query_date where dateandtime = #" & rqqdt _ & "# order by A. ArticleID DESC"

13. Date and Time
Example 1: List data of the current day
SQL = "select * From ctdate_by_query_date where dateandtime = Date () order by A. ArticleID DESC"

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.