I am trying to return information from a table (called addresses) with several columns. The physical address is divided into line1, line2, city, state, etc. I want to display all columns in the table, but want to combine the line1 and line2 columns into a single column named street.

Is there a way to do this without listing every single column on the table?

有帮助吗?

解决方案

Try like this

SELECT Line1 + ',' + Line2, city, state From Address

(Or)

SELECT concat(line1, ' , ', line2) , city, state From Address

其他提示

SELECT line1 + line2 AS street, city, state FROM addresses

Try this..

SELECT Line1 + ',' + Line2 as Street, city, state From [TableName]
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top