Home Why would SQL statement return out of ordered dataset?
Reply: 0

Why would SQL statement return out of ordered dataset?

user648
1#
user648 Published in May 25, 2018, 9:03 am

I have written a program that logs events into a db file as they happen using SQL statement. Whenever I open the table to view, I specifically request the dataset in descending order based on ALARM's date and time. It seems to work only for part of the table. I am using SQLite3 and my program is written in delphi or Pascal.

Here is the SQL statement:

SELECT * 
FROM Alarms 
ORDER BY datetime(ALARMTIME) DESC

Here is a snapshot of the table. Pay attention to the red arrows. That's where Alarm's date and time doesn't follow descending order. I don't know why this is happening.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.402978 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO