I have a financial management app I am working on and have been struggling to retrieve the data that i inserted, with conditions. I have two rows in my ‘income’ table labelled ‘PK’ and ‘timeStamp’. Every time a value is inputted, a timestamp is as well so then I can reference this when retrieving values. However, I can’t seem to figure out how to actually select these values according to their time and display them. This was my ‘test’ code which shows my idea of what I aimed to do, however it does not work.
for row in db:rows("SELECT * FROM income WHERE timeStamp BETWEEN os.date(""!%Y-%m-%d-7"") AND os.date(""!%Y-%m-%d"")") do local weekIncomeText = row.PK local t = display.newText( sceneGroup, weekIncomeText, 200, 2*row.PK, nil, 16) t:setFillColor( 0, 0, 0, ) end
(I did have a similar forum post earlier, but I think it won’t be seen due to it being over a month old)