sql| Date | statement
List data for one day, last 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&") "
data for all days of the week being queried
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)
query a time period
SELECT *
From Ctdate_by_query_date
WHERE DateAndTime between #2006 -5-1# and #2006 -5-30#
list years of different years, and do not have the same
SELECT distinct year (dateandtime) from ctarticle
Results such as:
Expr1000
2000
2003
2004
2005
2006
List one day, the first record of the previous year
SELECT top 1 DateAndTime from ctarticle where year (dateandtime) = (2006)-1
Sql= "SELECT top 1 dateandtime from ctarticle where year (dateandtime) = (Year (# &date&" #) "&norp
list data for a particular year
Sql= "SELECT * from Ctdate_by_query_date where year (dateandtime) =" &year (rqqdt_) & "ORDER BY dateandtime Desc"
find the first record in the previous month
SELECT top 1 DateAndTime from ctarticle where year (dateandtime) =year (#2006 -5-28#) and month (DateAndTime) =month (# 2006-5-28#)-1
list data for a January
Sql= "SELECT * from Ctdate_by_query_date where year (dateandtime) =" &year (rqqdt_) & "and month (dateandtime) =" &month (rqqdt_) & "ORDER BY dateandtime Desc"
list data for one day
Sql= "SELECT * from Ctdate_by_query_date where dateandtime=#" &rqqdt_& "# ORDER BY A.articleid Desc"
Time and date
Example one: List the data for the day
Sql= "SELECT * from Ctdate_by_query_date where dateandtime=date () Order BY A.articleid Desc"