New answers tagged

2

You can use the following: WHERE before <= date(at, (station || ' months') ) Please note that according to the documentation: "±NNN months" works by rendering the original date into the YYYY-MM-DD format, adding the ±NNN to the MM month value, then normalizing the result. Thus, for example, the data 2001-03-31 modified by '+1 month' initially ...


2

You have two problems compounding each other. First, you are using reserved words to and from (and also time) as your table columns, which is generally a bad idea. You have resolved that problem by quoting the questionable identifiers: "from" INTEGER NOT NULL, "to" INTEGER NOT NULL, Now you forget that from there on you must always quote these ...


-1

as in my comment : https://stackoverflow.com/questions/1845563/sqlite-equivalent-of-sql-server-dateadd-function -> WHERE before<=date(at,'+'+station+' month') if that doesn't work - try building '+'+station+' month' in a concat statement date will give you GMT / UTC based value - if you need it for local timezone, use DATETIME(at,'LocalTime', '+'...


1

Your approach to get a list of the columns is a good start. Then you can dynamically build a SQL statement to perform the tasks you like. However you need a way to loop over the results and execute the query. This is usually done with the help of the application you use to connect to the database, in your case Lua. If you are using the command line interface ...


Top 50 recent answers are included