سؤال

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