pull from table based on date?

Results 1 to 2 of 2

Thread: pull from table based on date?

  1. #1
    Join Date
    Dec 1969

    Default pull from table based on date?

    I&#039m trying to pull info from my table based on a date. I give the user the option on how many messages they want to see like 3 days, last 7 days, last year and so forth. Whatever they select is passed back to the page as a variable. So then I set up a variable called days. It says this.<BR><BR>days =trim(request.form("days"))<BR>if days = "" then<BR>days = 7<BR>end if<BR>days = Date-days<BR><BR>What I&#039m doing is pulling the amount of days the user wishes to see from the form, testing to make sure it isn&#039t empty and if so, then just pulling all the messages from the last 7 days. Then I take todays date and subtract the days variable from it and assign that to days. Am I going about this the wrong way? Then in my SQL, I have this.<BR><BR>status = "no"<BR>SQL = "SELECT * FROM message where reply = &#039" & status & "&#039 AND datdate &#062;= " & days<BR><BR>Any ideas? Thanks a lot!

  2. #2
    Curtis Guest

    Default RE: pull from table based on date?

    I think it is that line days = Date - days<BR><BR>but I like that idea.. I just think you have to do it a different way... because DATE is probably a function just like Now() .. and you can&#039t just say days = Now - days .. now can you?<BR>so...

Posting Permissions

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