Alberto Simões <[EMAIL PROTECTED]>
wrote:
I have this simple schema for news:
sqlite> .schema
CREATE TABLE news (year,month,day,title,text);
CREATE INDEX date ON news(year,month,day);
And this query results not as expected...
sqlite> SELECT * FROM news ORDER BY year DESC,month DESC,day DESC;
2007|7|7|Novo design|...
2007|6|19|10.000 palavras|...
2007|7|15|Actualização das regras de transcrição|...
My guess would be, some of the values are stored as integers and others
as text strings. What does the following query return:
select typeof(year), typeof(month), typeof(day)
from news;
If you find from this query that not all fields are stored as integer,
then you need to do two things. First, fix your existing data like this:
update news set
year=CAST(year as integer),
month=CAST(month as integer),
day=CAST(day as integer);
Second, examine the code that inserts new records to figure out how
strings made their way into the table in the first place.
For more details, see http://sqlite.org/datatype3.html
Igor Tandetnik
-
To unsubscribe, send email to [EMAIL PROTECTED]
-