How to iterate in this query?
Posted
by Umaid
on Stack Overflow
See other posts from Stack Overflow
or by Umaid
Published on 2010-05-02T13:50:40Z
Indexed on
2010/05/02
13:57 UTC
Read the original article
Hit count: 170
Filed under:
c
for (int I=-1; I<30; I++)
{
for (int J=0; J<30; J++)
{
for(int K=1; K<30; K++)
{
SELECT rowid,Month, Day, Advice from MainCategory where Month= 'May ' and Day in ((cast(strftime('%d',date('now','+(I) day')) as Integer)),(cast(strftime('%d',date('now','+(J) day')) as Integer)),(cast(strftime('%d',date('now','+(K) day')) as Integer)));
}
}
}
And for the same reason how to decrement in this query
for (int I=-1; I<30; I--)
{
for (int J=0; J<30; J--)
{
for(int K=1; K<30; K--)
{
SELECT rowid,Month, Day, Advice from MainCategory where Month= 'May ' and Day in ((cast(strftime('%d',date('now','(I) day')) as Integer)),(cast(strftime('%d',date('now','(J) day')) as Integer)),(cast(strftime('%d',date('now','(K) day')) as Integer)));
}
}
}
© Stack Overflow or respective owner