I want to get one record before start date and end date
DtpFrom means – 'date picker from
DtpTo means – 'date picker to
VB 6 CODE
sdate = DateToString(dtpFrom)
edate = DateToString(dtpTo)
QUERY
Where DATE BETWEEN '" & sdate & "' AND '" & edate & "'"
I want to get one record before sdate and edate
I tried this code
VB 6 CODE
s1sdate = -sdate
e1edate= -edate
QUERY
Where DATE BETWEEN '" & s1date & "' AND '" & e1date & "'"
But it is going one day minus
Example
Selecting 03/05/2009 to 03/06/2009 from date picker, but it showing record from
02/05/2009 to 02/06/2009.
I want to display one record before from the selecting date and ending date, not one day before, because my table is not a continous date.
ADDITIONAL EXAMPLE:
If we have a table and rows [ ID(int) , Value(Money) ] and we have some rows in it
ID --Value
1------70
2------100
3------150
8------200
20-----250
45-----280
and we want to make Query that get each row ID, Value and the previous Row Value in which data appear as follow
ID --- Value ---Prev_Value
1 ----- 70 ---------- 0
2 ----- 100 -------- 70
3 ----- 150 -------- 100
8 ----- 200 -------- 150
20 ---- 250 -------- 200
45 ---- 280 -------- 250
i make the following query but i think it's so bad in performance in huge amount of data
select t1.id, t1.value, t2.value from table t1 inner join table t2 on t1.id = t2.id where t2.value = (select max(value) from table t where t.value< t1.value and t.id = t1.id ) and T1.value BETWEEN '" & sdate & "' AND '" & edate & "'
Need VB 6 CODE OR ACCESS QUERY HELP.