Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

  • DATEADD('d”,-7,DATE()) as [last-week]

Date()

See https://support.microsoft.com/en-us/office/date-function-dd7a1f27-d957-4969-ab35-01e0bfbfed76

Expression

Results

SELECT Date() AS Expr1 FROM ProductSales GROUP BY Date();

Returns the current system "date" for in short date format. Result: "dd/mm/yyyy".

SELECT Date()-[DateofSale] AS DaysSinceSale FROM ProductSales;

Returns the difference between current system "Date" and date values of the field "DateofSale" as number and displays the results in column "DaySinceSale".

Now()

Returns the current date and time according your computer's system date and time. https://support.microsoft.com/en-us/office/now-function-671467d4-aed0-4a78-b533-b7b87a533b5a

Expression

Results

SELECT Now() AS Expr1 FROM ProductSales GROUP BY Now();

Returns the current system "Date and Time" in the default system Time format and displays in the column Expr1.

SELECT Now() AS CurrentDateandTime FROM ProductSales GROUP BY Now();

Returns the current system "Date and Time" in the default system Time format and displays in the column CurrentDateandTime.

External Pages on SQL for Text (.CSV) Data Sources