简体   繁体   English

无法在 DB2 中获取列名

[英]Unable to fetch the column name in DB2

在此处输入图片说明

When I am using an expression as a column(without alias) in my query, the driver returns the column number, instead of the name当我在查询中使用表达式作为列(没有别名)时,驱动程序返回列号,而不是名称

How can I fetch the column names, instead of column numbers?如何获取列名而不是列号?

在此处输入图片说明

If you want to retrieve columns by name, then give that column a name using AS .如果要按名称检索列,请使用AS为该列命名。

Change your query to:将您的查询更改为:

select sum(a.salary) as total_salary, a.id from q.staff a group by a.id

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM