摘要:
SELECT col1, col2, CASE WHEN col3 > 1 AND col3 <2 THEN '1' WHEN col3 > 2 AND col3 <3 THEN '2' WHEN col3 > 3 AND col3 <4 THEN '3' ELSE '4' END mylevel FROM table1 SELECT CASE SIGN(5 - 5) WHEN 1 THEN 'Is Positive' WHEN -1 THEN 'Is Negative& 阅读全文
posted @ 2011-02-26 19:21
玲珑少年
阅读(479)
评论(0)
推荐(0)
摘要:
Postgres 格式化函数提供一套有效的工具用于把各种数据类型(日期/时间,int,float,numeric)转换成格式化的字符串以及反过来从格式化的字符串转换成原始的数据类型。 注意:所有格式化函数的第二个参数是用于转换的模板。 表 5-7. 格式化函数 函数 返回 描述 例子 to_char(timestamp, text) text 把 timestamp 转换成 string to_char(timestamp 'now','HH12:MI:SS') to_char(int, text) text 把 int4/int8 转换成 string to_ 阅读全文
posted @ 2011-02-26 19:09
玲珑少年
阅读(279)
评论(0)
推荐(0)