View's SELECT contains a subquery in the FROM clause

后端 未结 4 924
走了就别回头了
走了就别回头了 2020-11-28 08:41

I have two tables and I need to create a view. The tables are:

credit_orders(id, client_id, number_of_credits, payment_status)
credit_usage(id, client_id, cr         


        
4条回答
  •  爱一瞬间的悲伤
    2020-11-28 09:44

    As the more recent MySQL documentation on view restrictions says:

    Before MySQL 5.7.7, subqueries cannot be used in the FROM clause of a view.

    This means, that choosing a MySQL v5.7.7 or newer or upgrading the existing MySQL instance to such a version, would remove this restriction on views completely.

    However, if you have a current production MySQL version that is earlier than v5.7.7, then the removal of this restriction on views should only be one of the criteria being assessed while making a decision as to upgrade or not. Using the workaround techniques described in the other answers may be a more viable solution - at least on the shorter run.

提交回复
热议问题