sql - Last 10 days Values based on Last available data -
sql - Last 10 days Values based on Last available data -
i have fetch info table in such way start date fetch info based on date lastly info inserted.
for illustration have info 24/01/2011
now. specific id have inserted lastly info on 24/01/2012
. in case id have fetch info 14/01/2012
24/01/2012
.
because don't know lastly date when info inserted , first have fetch max of date , based on can find start date. there fast way that. handled in single , fast query.
if understand question, reply may this:
select * table_1 t1 table_1.start_date >= to_date('14/01/2012', 'dd-mm-yyyy') , table_1.start_date <= (select max(t11.insert_date) table_1 t11 t1.id = t11.id)
sql firebird
Comments
Post a Comment