Creating MySQL View using UNION

后端 未结 5 1826
逝去的感伤
逝去的感伤 2021-02-14 06:18

I am trying to create a view for the following query.

SELECT DISTINCT
  products.pid        AS id,
  products.pname      AS name,
  products.p_desc     AS descri         


        
5条回答
  •  广开言路
    2021-02-14 06:50

    You might want to swith the order of userid and location in the second select. The column names should match 1 to 1 in all selects of the union.

    EDIT : For query browser , as this points out "To create a view from a query, you must have executed the query successfully. To be more precise, the view is created from the latest successfully executed query, not necessarily from the query currently in the Query Area"

    so you need to execute the query first before you create the view in query browser.

    The error is from the query browser and not mysql.

提交回复
热议问题