sql query to sort timestamp -


select  b.id st,a.appname name_st , b.no_clicks clicks,  b.first_usage ft ,  b.last_usage lu  (select appname, appid oneclick_apps) , (select   application_id id, count(*) no_clicks, to_char( min(accessed_time),'dd-mm-yyyy hh:mm:ss')  first_usage, to_char( max(accessed_time),'dd-mm-yyyy hh:mm:ss')  last_usage   user_db   upper(user_id) upper('e243378')   group user_application ) b  b.id = a.appid  order lu asc 

is query....which sorts in ascending order...only in terms of year...what modifications should make sorts entire dd:mm:yyyy hh:mm:ss ?

select b.id st, a.appname name_st,         b.no_clicks clicks, b.first_usage ft , b.last_usage lu  (select appname, appid oneclick_apps) a,       (select application_id id, count(*) no_clicks,               to_char( min(accessed_time),'dd-mm-yyyy hh:mm:ss') first_usage,               to_char( max(accessed_time),'dd-mm-yyyy hh:mm:ss') last_usage        user_db        upper(user_id) upper('e243378')       group user_application ) b  b.id = a.appid  order lu asc 

i see 3 options off top of head.

  1. don't convert timestamps strings.
  2. convert timestamps strings sort correctly strings. (yyyy-mm-dd hh:mm:ss)
  3. include both converted , unconverted timestamps. display converted; sort on unconverted. (a variation on #1)

i prefer #1. if client applications need different display, let them handle it.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -