Can a MySQL query turn rows into columns?

前端 未结 3 822
醉话见心
醉话见心 2020-12-01 10:25

I have a number of tables I am trying to combine with joins but as such, the results are returned in a number of rows whereas I would like to have them generated as new colu

3条回答
  •  不知归路
    2020-12-01 10:54

    This is not exactly what you are looking for, but it might be a step in the right direction.

    SELECT 
         Table1.memberIDs, 
         Table1.firstname, 
         Table1.lastnames, 
         Table2.programIDs, 
         Table3.description 
    FROM 
         Table1, 
         Table2, 
         Table3 
    WHERE 
         Table1.memberIDs = Table2.memberIDs AND 
         Table2.programIDs = Table3.programID
    

提交回复
热议问题