• ThinkPHP视图查询


    ThinkPHP视图查询

    一、总结

    1、这里的视图查询和多表查询很像,当然多表查询的话肯定要支持左右链接查询

    2、view:视图的使用,关键字是view

    3、sql视图功能支持:thinkphp支持视图,也就是告诉我们,sql里面的视图,存储过程啥的thinkphp这些框架等都支持

    二、ThinkPHP视图查询

                                $data=Db::view("goods","id,name,price")

                                                   ->view("type",'name tname',"type.id=goods.cid")

                                                   ->select();

                                // SELECT `goods`.`id`,`goods`.`name`,`goods`.`price`,type.name tname FROM `goods` `goods` INNER JOIN `type` `type` ON `type`.`id`=`goods`.`cid`

                                $data=Db::view("goods","id,name,price")

                                                   ->view("type",'name tname',"type.id=goods.cid","left")

                                                   ->select();

                                // SELECT `goods`.`id`,`goods`.`name`,`goods`.`price`,type.name tname FROM `goods` `goods` LEFT JOIN `type` `type` ON `type`.`id`=`goods`.`cid`

  • 相关阅读:
    ajax方式下载文件
    chrome常用插件
    c3p0配置之preferredTestQuery参数默认值探秘
    细说tomcat之集群session共享方案
    细说tomcat之session持久化探秘
    细说tomcat之类加载器
    细说tomcat之应用监控
    细说RESTful API之设计原则
    细说RESTful API安全之防止重放攻击
    细说RESTful API安全之防止数据篡改
  • 原文地址:https://www.cnblogs.com/Renyi-Fan/p/9017265.html
Copyright © 2020-2023  润新知