如何在 MySQL 中合并具有相同 table 的多个列,VB NET

How to merge multiple columns with the same table in MySQL , VBNET

我有一个显示个人信息的数据网格。我想做的是合并列(houseno、town、province、street)并将其显示为一个。我怎样才能做到这一点? 这是我的代码:

conn = New MySqlConnection
    conn.ConnectionString = "server=localhost; userid=root; password=root; database=dbase"

    Dim da As New MySqlDataAdapter
    Dim bs As New BindingSource

    Try
        conn.Open()
        Sql = "SELECT facultyNo AS `Faculty ID`, " & _
                        "firstname AS `Firstname` , " & _
                        "middlename AS `Middlename` , " & _
                        "lastname AS `Lastname` , " & _
                        "gender AS `Gender` , " & _
                        "homeadd_houseno & homeadd_brgy & homeadd_street & homeadd_town AS `Home Address` , " & _ "THIS IS WHAT I WANTED"
                        "tersiary_schoolname AS `School Name` , " & _
                        "tersiary_address AS `School's Address` , " & _
                        "tersiary_degree AS `Degree` , " & _
                        "tersiary_batch AS `Batch` , " & _
                        "birthdate AS `Birthdate` , " & _
                        "contact_mobileno AS `Mobile No.` , " & _
                        "contact_telno AS `Telephone No.` , " & _
                        "age AS `Age` , " & _
                        "collegeSchool AS `Tersiary` , " & _
                        "schoolAdd AS `School's Address` , " & _
                        "emailAdd AS `Email Address` , " & _
                        "contactno AS `Contact Number` " & _
                        "FROM dbase.tblfacultyinfo"
        cmd = New MySqlCommand(Sql, conn)
        da.SelectCommand = cmd
        da.Fill(dt)
        bs.DataSource = dt
        DataGridView1.DataSource = bs
        da.Update(dt)

        conn.Close()
    Catch ex As MySqlException
        MsgBox(ex.Message)
    Finally
        conn.Dispose()
    End Try
End Sub

SQL 使用 '+' 而不是 '&' 进行字符串连接,所以试试...

homeadd_houseno + ' ' + homeadd_brgy + ' ' + homeadd_street + ' ' + homeadd_town AS `Home_Address`

使用CONCAT

select concat (homeadd_houseno,', ',homeadd_brgy,', ',homeadd_street,', ',homeadd_town ) AS `Home Address` 
from
dbase.tblfacultyinfo