通过实体框架更新MySQL视图="每个派生表必须有自己的别名"

时间:2013-03-22 00:28:25

标签: asp.net mysql entity-framework

我试图通过Entity框架更新MySQL视图并获取错误“每个派生表必须有自己的别名”。

关于如何改变观点以防止这种情况的任何想法?这是我的MySQL视图代码:

    select 
  a.compid AS compid,
  a.loid AS loid,
  a.purchase_rate AS purchase_rate,
  a.purchase_min AS purchase_min,
  a.purchase_max AS purchase_max,
  a.refi_rate AS refi_rate,
  a.refi_min AS refi_min,
  a.refi_max AS refi_max,
  a.quarter AS quarter,
  a.year AS year,
  a.changed_on AS changed_on,
  a.user_changed AS user_changed,
  a.is_active AS is_active,
  a.notes_id AS notes_id,
  b.branch AS branchID,
  b.name AS lo_name,
  c.branch_name_friendly AS branchname 
from ((encompassdata.comp a 
  inner join default.users_encompass b on
    (
      (a.loid = b.un_enc)
    )) 
  inner join default.branch_info c on
    (
      (b.branch = c.branch_id)
    ))

1 个答案:

答案 0 :(得分:0)

尝试抛弃FROM子句中的所有括号

SELECT a.compid AS compid,
       ...
  FROM encompassdata.comp a INNER JOIN
       default.users_encompass b on a.loid = b.un_enc INNER JOIN
       default.branch_info c on b.branch = c.branch_id