Poor Man's SQL Pivot. List Questions as Columns and Answers per User in one row

后端 未结 5 1448
轮回少年
轮回少年 2020-12-02 01:44

Current query:

SELECT order_id AS OrderNumber, ordName, ordLastName, question, answer 
FROM cart_survey 
JOIN orders 
    ON cart_surv         


        
5条回答
  •  自闭症患者
    2020-12-02 02:09

    This is called a pivot, where information in rows is used to determine the list of columns. This sort of query requires dynamically-computed SQL if done entirely in a query, and is usually better suited to client-side formatting instead (many tools call it a pivot or cross-tab query, SSRS calls it a matrix query).

提交回复
热议问题