最近在做项目,有这么一个情况,目前数据库上面有3个字段,year,month,day分别表示年,月,日,现在我需要把他们合并到一起,可以使用这
最近在做项目,有这么一个情况,目前数据库上面有3个字段,year,month,day分别表示年,月,日,现在我需要把他们合并到一起,可以使用这种sql语法
to_date(y.year||y.month||y.day,'yyyy-mm-dd')
这样就可以把他们3个合并到一个字段上面来了,那么我们也可以把他们分解开,像这样
to_char(t.collect_date,'yyyy') as year,to_char(t.collect_date,'mm') as month,to_char(t.collect_date,'dd') as day
,
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn