General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Select last 5 days in between
Hello,
MyTable is:
cSname dDate
aaaaaa 08/15/2004
bbbbbb 08/15/2004
cccccc 08/17/2004
dddddd 08/17/2004
eeeeee 08/19/2004
ffffff 08/14/2004
gggggg 08/14/2004
hhhhhh 08/20/2004
iiiiii 08/21/2004
jjjjjj 08/03/2004
kkkkkk 08/03/2004
I would like to put the last 5 days into Mycursorresult to have
aaaaaa 08/15/2004 ( day number 5 to pick )
bbbbbb 08/15/2004
cccccc 08/17/2004
dddddd 08/17/2004
eeeeee 08/19/2004
hhhhhh 08/20/2004
iiiiii 08/21/2004 ( day number 1 to pick )
I try this but never worked because dDate can be skipped 1 or more days in
between like the above sample.
local ldStart,ldStop,lcQuery
ldStart = first day to pick {08/21/2004}
ldStop = 5th day to pick {08/15/2004}
** and it is not the last 5 days in the row from 08/21/2004 to 08/17/2004
lcQuery=Select * from mytable where dDate between ?ldStart and ?ldStop
into mycursorresult
Please fix my query or advise me how to do it
TIA
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only