djomla — 2010-07-21T10:42:24-04:00 — #1
Hi to all.
I have a problem with sorting data withing current_date.
For example i have a table that have field wdate as timestamp. I need to extract all record for today but from 06 in the morning to 24.
In the beginning i was working order by wdate ASC but i need this way of ordering, is it possible?
r937 — 2010-07-22T05:28:40-04:00 — #2
that's quite interesting
djomla — 2010-07-22T04:53:41-04:00 — #3
I found better solution, and if someone will have something like this in the future here it is :
wdate BETWEEN TO_CHAR(current_date + interval '06:00', 'YYYY-MM-DD HH24:MI:SS') AND TO_CHAR(current_date + interval '1 day 06:00', 'YYYY-MM-DD HH24:MI:SS')
djomla — 2010-07-22T04:15:07-04:00 — #4
r937 — 2010-07-21T13:47:22-04:00 — #5
timestamp as in TIMESTAMP (essentially a date and time), or timestamp as in unix timestamp (an INTEGER like 1279734431)?
djomla — 2010-07-21T11:34:54-04:00 — #6
WHEN TO_CHAR(wdate, 'HH24') BETWEEN '24' AND '06' THEN 'b'
WHEN TO_CHAR(wdate, 'HH24') BETWEEN '06' AND '24' THEN 'a'
ELSE 'evening' END as wha
Then i order by wha asc and wdate asc - thats it