Need to get 3 record for database on current date using sqlite

SELECT rowid, Day, Advice from MainCategory where ((Day = ((cast(strftime('%d',date('now','-1 day')) as Integer)))) and (Month = (strftime('%m',date('now'))))) and ((Day = ((cast(strftime('%d',date('now')) as Integer)))) and (Month = (strftime('%m',date('now'))))) , ((Day = ((cast(strftime('%d',date('now','+1 day')) as Integer)))) and (Month = (strftime('%m',date('now',+1 month)))));

What if i make my Month column in Integer data type then it would be.

SELECT rowid, Month, Day, Advice from MainCategory where ((Day = ((cast(strftime('%d',date('now','-1 day')) as Integer)))) and (Month = (strftime('%m',date('now'))))) and ((Day = ((cast(strftime('%d',date('now')) as Integer)))) and (Month = (strftime('%m',date('now'))))) , ((Day = ((cast(strftime('%d',date('now','+1 day')) as Integer)))) and (Month = (strftime('%m',date('now',+1 month)))));

Please note that I have over this scenerio when I am in middle of month but below query returns 2 records and 1 from begining from all 11 months as (feb is exclusive) then record will be 33 but i need three 3 records from the table and increment it on next button.

Please write 3 querys one which return all three record on current date, next all 3 records must be incremented by 1 on every next button click finally all 3 records must be decremented by 1 on every previous button click keep last day and begining date on the month in minds else i have also achieved for middle of month.

Running query but returns 33 records instead of 3.

SELECT rowid,Month, Day, Advice from MainCategory where Day in ((cast(strftime('%d',date('now','-1 day')) as Integer)),(cast(strftime('%d',date('now')) as Integer)),(cast(strftime('%d',date('now','+1 day')) as Integer)));

0 answers