Question

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?

Was it helpful?

Solution

Try like this

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

(Or)

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

OTHER TIPS

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

Try this..

SELECT Line1 + ',' + Line2 as Street, city, state From [TableName]
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top