I have a field which contains a string of numbers
"2002 2005 2001 2006 2008 2344"
It is preferred that we assume the spaces are the splits, else failing that, that they are 4 characters long each.
I can select a substring:
SELECT substr(years,1,4) FROM TABLE
But have no idea how to check each one. I am trying to find the row that contains the number closest to 0.
and I can ORDER BY and LIMIT 1.
This looks UGLY but it selects all you need in one SQLlite statement. Also you can do some optimization if assume dates are in the current interval say 1900..2100. In this case you can cut first 2 selects B,C (B: 1 union 2) (C: 9 union 0 union 1)