This topic is locked

Help on a select statement

8/28/2008 2:11:52 PM
PHPRunner General questions
author

I'm trying to limit the data that is returned based upon a calendar date. Lets say five days after a start date.
How would I write the where statement?
If I get that solved where in the world would I put the Select statement?
Thanks for helping me out.

J
Jane 8/29/2008

Hi,
you can add where clause on theEdit SQL query tab. Turn on SQL mode and add your WHERE clause.

Actual code is dependent on database type.

501328 8/30/2008

Thanks again Jane,
I did figure that out...sorry about not updating the post.
Question: I have the where statement > where FromDate>Now()


This is working... but what if I want to show the records of the "FromDate" for only 5 days after the "FromDate"
Again, thank you for helping me.

J
Jane 9/1/2008

Try to use this one:

where FromDate>Now() and FromDate<Now()+5

501329 9/2/2008

Try to use this one:



Thanks Jane,
I tried this...it shows the same records as the original Where FromDate>Now().
Could I be doing something wrong? Is there anything I else I can try?
Thanks again for your help!

J
Jane 9/2/2008

Sorry for my fault.

Here is the correct code:

where FromDate>Now() and FromDate<date_add(curdate(), interval 5 day)

501330 9/2/2008

Sorry for my fault.

Here is the correct code:


Thanks again Jane,
I tried this code and it is returning 0 records now. I have checked the FromDate field and I should be getting at least 5 records.
Again, I want to thank you for taking the time to help me.

501331 9/2/2008



Thanks again Jane,
I tried this code and it is returning 0 records now. I have checked the FromDate field and I should be getting at least 5 records.
Again, I want to thank you for taking the time to help me.


Hi Jane,
I played around and finally got it working. Here is what I'm using

where FromDate<>Now()

and FromDate>=date_add(curdate(), interval -5 day)


I'm sure I didn't explain what I wanted it to do correctly.
I want to thank you again for helping me. I'm sure I will be back asking questions.