pgsql常用函数

拼接两个字符串

concat_ws(‘_’,a.emp_code,a.emp_name)

case when

(case when a.status =’1’
then ‘在职’
else ‘离职’
end )as status ,

加上行号

(row_number() OVER (ORDER BY a.emp_first_dept_code)+ 30000) as rownums

int转text

a.emp_first_dept_code::text::int 
a.emp_dept_info_id ::int::text  

转化时间成字符串

to_char(a.exam_start_time,'yyyyMM')

时间转化为 24 小时 字符串

 to_char(a.ptc_date,'yyyy-MM-dd hh24:MI:ss')

判断符

  COALESCE (a.store_used_bonus,0)  as storeusedbonus, -- 为null ,则0,否则为自己

列转行

string_agg(a.empname,’,’) as empname

你可能感兴趣的:(java基础入门)