一对多查询
listagg() with group()
listagg(colName,’,’) within group(order by t.colName)查询从表,在每个分组内,LISTAGG根据order by子句对列进行排序,将排序后的结果以指定字符拼接起来
select listagg(t.code_name,',') within group(order by t.code_value) as education
from code_value t
where t.code_type = 'AAC011'
判断查询
decode
decode(条件,值1,返回值1,值2,返回值2,…值n,返回值n,缺省值)
日期
根据生日查询年龄
select floor(months_between(sysdate,to_date('1995-09-26 00:00:00','yyyy-MM-dd hh24:mi:ss'))/12) as age
from dual;
原创文章,作者:,如若转载,请注明出处:https://blog.ytso.com/273838.html