基础函数及解析可参考:
http://blog.csdn.net/snn1410/article/details/7741283
PostgreSQL自带to_date(text, text)、to_timestamp(text, text);不存在to_time函数
需求:
08:30-20:30 → A
20:30-08:30 → B
脚本:
SELECT ( CASE WHEN (to_char(finished - time '08:30', 'HH24') > '11') THEN 'B' ELSE 'A' END ) bbCode FROM tablename
finished - time '08:30' (08:30即节点时间,逆时针方向倒转至0点,则0-12为A,12-24为B)