摘要: select country, sum( case when sex = '1' then population else 0 end), --男性人口 sum( case when sex = '2' then population else 0 end) --女性人口 from table_a 阅读全文
posted @ 2016-09-26 13:55 esther-qing 阅读(17366) 评论(0) 推荐(0)
摘要: 1.int装string select CAST (1234 AS text) --5 附: PostgreSQL 类型转换函数 to_char (timestamp, text ) to_char ( double precision , text ) 阅读全文
posted @ 2016-09-26 11:46 esther-qing 阅读(18961) 评论(0) 推荐(1)
摘要: select round(1::numeric/4::numeric,3);结果为0.25select round( cast ( 1 as numeric )/ cast( 4 as numeric),2); 阅读全文
posted @ 2016-09-26 11:01 esther-qing 阅读(7378) 评论(0) 推荐(0)
摘要: 1.获取当前日期的年份 阅读全文
posted @ 2016-09-26 10:59 esther-qing 阅读(34710) 评论(0) 推荐(0)