Math in a Select Statement

Results 1 to 2 of 2

Thread: Math in a Select Statement

  1. #1
    Join Date
    Dec 1969

    Default Math in a Select Statement

    Okay, I have this cheesy lil messageboard where people can post messages and they are displayed on a home page. I want to set it up so that the home page board will only show messages that have been posted within the last 10 days, after that....the home page won&#039;t display them anymore. When a message is added, a hidden field adds the current date-n-time with vbscript &#039;now&#039; <BR>Below is my current select statement. Can anyone throw me a bone on this one?<BR><BR>mbstrSQL = "SELECT * FROM messageboard1 ORDER BY datetime DESC"<BR><BR>Thanks!<BR>-Ferretworks<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Math in a Select Statement

    SELECT * FROM messageboard1 WHERE Datediff("d",Getdate(),[datetime]) &#060; 10<BR>ORDER BY datetime desc<BR><BR>This is the valid instruction for SQL server, I believe Access&#039; DATADIFF function uses something else for the "d" in the function. It is in the docs.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts