jose isaias cabrera wrote:
> I know that the IN clause contains a list of something. I.e.
>
> IN ('2014-01-01', '2014-01-02', '2014-01-03', '2014-01-04', '2014-01-05')
>
> So the question is, is there a shorter way for one to say something like,
>
> IN ('2014-01-01', ..., '2014-01-05')
>
> where the content of the IN would have the first item and the last item of
> the list, but that's it?
In this case, BETWEEN works just fine.
In the general case, you can create a series of values with a common table
expression:
WITH RECURSIVE dates(d) AS (
SELECT '2014-01-01'
UNION ALL
SELECT date(d, '+1 day')
FROM dates
WHERE d < '2014-01-05'
)
SELECT * FROM MyTable WHERE MyColumn IN dates;
Regards,
Clemens
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users