SQL Combine Two Columns in Select Statement

前端 未结 5 1537
栀梦
栀梦 2020-12-03 10:23

If I have a column that is Address1 and Address2 in my database, how do I combine those columns so that I could perform operations on it only in my select statement, I will

5条回答
  •  情深已故
    2020-12-03 10:30

    In MySQL you can use:

    SELECT CONCAT(Address1, " ", Address2)
    WHERE SOUNDEX(CONCAT(Address1, " ", Address2)) = SOUNDEX("Center St 3B")
    

    The SOUNDEX function works similarly in most database systems, I can't think of the syntax for MSSQL at the minute, but it wouldn't be too far away from the above.

提交回复
热议问题