我的箱子有什么问题? [英] What's wrong with my CASE?

查看:100
本文介绍了我的箱子有什么问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


case table1.text为空然后以table2.numbers
ELSE table1.text
结尾为新列

运行此代码时,我不断收到此错误:
错误:大小写不同的字符和整数不能匹配

When running this code I keep getting this error: ERROR: CASE types character varying and integer cannot be matched

您会认为这不会引起问题,因为我正在查询中创建新列。我还想指出的是,如果有帮助,我正在使用旧版本的PostgreSQL。

You would think that this would not cause problems since I'm creating a new column within my query. I'd also like to point out that I'm using an old version of PostgreSQL if that helps.

推荐答案

CASE WHEN table1.text IS NULL THEN table2.numbers::text ELSE table1.text END AS newcolumn

这篇关于我的箱子有什么问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆