Adding month and date values to an attribute containing only year psql

人走茶凉 提交于 2019-12-12 03:43:49

问题


Right now I have dates that look like this format(datecreated from table2)

 +1999
 +1999
 -0700
 -0480

And I want them to look like (inserted into creationdate in table)

1999/12/31
1999/12/31
-700/12/31
-480/12/31

This is my best attempt so far (the numid and accnum are just to find where the records match)

update table set creationdate = to_date('1231'||(to_char((select datecreated from table2 m, table n where m.accnum = n.numid), 'sg9999')),'MMDDSGYYYY');

来源:https://stackoverflow.com/questions/40944531/adding-month-and-date-values-to-an-attribute-containing-only-year-psql

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!