zoukankan      html  css  js  c++  java
  • 在查询用户的权限的时候 使用左外连接 和 access数据库中左外连接

    一般做视图最好是做成左外连接的。而其作用尤其在我们查询用户当前的权限时尤为明显,我们将 权限表即模块表放→角色权限表→角色表→用户角色表→用户表 就这样left outer join 连接起来,这样就保证了该用户的所用权限都能查询出来。

    access数据库中的左外连接很特别,它是先写里面的然后逐步扩展到最后,先执行里面的。

    例子

    SELECT xt_user.Pkid, xt_user.UserID, xt_user.UserName, xt_user.Password, xt_user.Status, xt_module.ModuleName
    FROM (((xt_module LEFT JOIN xt_rolemodule ON xt_module.Pkid = xt_rolemodule.ModulePkid) LEFT JOIN xt_role ON xt_role.Pkid = xt_rolemodule.RolePkid) LEFT JOIN xt_userrole ON xt_role.Pkid = xt_userrole.RolePkid) LEFT JOIN xt_user ON xt_user.Pkid=xt_userrole.UserPkid;

  • 相关阅读:
    P5107 能量采集
    P4655 [CEOI2017]Building Bridges
    P1129 [ZJOI2007]矩阵游戏
    P5299 [PKUWC2018]Slay the Spire
    P1625求和 giao精大杂烩
    背包
    根号分治
    CF963B
    国王游戏
    P6006 USACO 3SUM G
  • 原文地址:https://www.cnblogs.com/woshijishu3/p/4207564.html
Copyright © 2011-2022 走看看