@accalia said in SQL Date functions are hard:
@djls45 said in SQL Date functions are hard:
What is the datatype for the column?
almost certainly
CHAR(12)
I would have expected that too, but its time
@djls45 said in SQL Date functions are hard:
What sorting method is it using? RTL string sorting?
most likely.... row order which would be more or less order of insertion in most collations, assuming no indexing
Correct, no index, no keys, no nothing else but a table generated from 1440 inserts in a script.
A far as I could find, this is only used to generate a report of the application usage, using this query:
select date_, hd.hora, count(*) as q
from users_logins h
join hora_dia hd
on hd.hora between convert(time,convert(char(8),h.hora)) and convert(Time,GetDate())
where hd.hora between convert(time,convert(char(8),h.hora)) and convert(Time,GetDate())
group by fecha, hd.hora
Guess he wanted to discard 4-dimensional users using the software outside time?