Click here to Skip to main content
15,899,679 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
3007920177113	30079	07/01/2017		15:22
3007920177115	30079	07/01/2017	15:41	
3056320177116	30563	07/01/2017	16:35	
3050720177116	30507	07/01/2017		16:35
3050720177117	30507	07/01/2017	17:03	
3056320177117	30563	07/01/2017	17:32	
3023420177117	30234	07/01/2017		19:00
3007920177117	30079	07/01/2017		19:03
3009720177117	30097	07/01/2017		19:04
3057820177117	30578	07/01/2017		19:32
3056320177120	30563	07/01/2017	20:17	
3045520177122	30455	07/01/2017	22:03	
4018720177122	40187	07/01/2017		22:30
3050720177122	30507	07/01/2017	22:30	
302342017729	30234	07/02/2017	9:48	
300972017729	30097	07/02/2017	9:59	
3057820177210	30578	07/02/2017	10:22	


the data is in sqlite format. i am trying to sort the time in line with the corresponding dates and access codes. i am using c# and sqlite. please help. im stuck. thank you.

What I have tried:

i am a beginner c# and sqlite user so i dont know much on what algorithm to use to sort the time.
updated the post to contain a bit more info.
this is how i made the table, EnumDate exist to avoid getting double records.
CREATE TABLE "blank" ("EnumDate" text PRIMARY KEY  NOT NULL  DEFAULT (null) ,"AccessCode" text DEFAULT (null) ,"Date" Text DEFAULT (null) ,"In0" text DEFAULT (null) ,"Out1" text DEFAULT (null)
Posted
Updated 10-Jul-17 1:50am
v3
Comments
CHill60 10-Jul-17 7:27am    
It depends how you have stored the time - at the very least share your table schema, or the query you ran to get the results above

1 solution

Probably something like this:
SQL
SELECT AccessCode, AccessDate FROM MyTable
ORDER BY AccessCode, AccessDate

That should give you something like this:
30079	02/07/2017	19:01
30097	02/07/2017	19:01
30097	03/07/2017	10:12	
30234	02/07/2017	19:00
30234	03/07/2017	 9:58	
30455	02/07/2017	21:01
30507	02/07/2017	21:53
30563	03/07/2017	10:36	
30578	02/07/2017	19:31
40187	02/07/2017	22:00	
40456	02/07/2017	22:00	
Where the access codes are together, and the dates are in order by code.

But this depends on your DB holding data in sensible column datatypes - if it doesn't then it could fail very easily.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900