夺命雷公狗TP下关联查询
2016-04-18 19:40
681 查看
记录下我们常用的关联查询:
public function add4(){ $id=$_GET['id']; $this->list = M("student")->table("hx_student stu,hx_subject sub") ->where("stu.id=$id and stu.bmcx=sub.motorcycletype") ->field('stu.name,sub.examination,sub.name subname,sub.id subid')->select(); $this->display('add4'); } $total = $model-> table('hx_test t, hx_student s, hx_subject b')-> where('s.id=t.studentid and b.id=t.subjectid')-> count();//获取总数据条数 $lists = $mod ->field('s.name sname,t.name tname,a.oddnumbers,a.evaluate,a.grade,a.time,a.id')-> table("hx_appraise a,hx_student s,hx_train t")-> where("s.id=a.studentid and t.id=a.trainerid")-> limit($page->firstRow.','.$page->listRows)->order('id DESC')->select(); $this ->assign('lists',$lists);
相关文章推荐
- php注册审核显示
- ubuntu下thinkphp集成极光推送,推送消息时失败,无法加载模块:50x
- gearman 在mac上为php添加Gearman扩展
- php 发送get,post 请求
- Laravel 5 中使用 Laravel Excel 实现 Excel/CSV 文件导入导出功能
- PHP缓存技术OB系统函数--静态缓存与局部缓存
- Notepad++ ,EditPlus 连接 FTP 进行文件编辑
- php中的变量作用域
- 【干货】PHP 代码规范简洁之道
- 利用php制作简单的文本式留言板
- PHP设计模式之——工厂模式
- php 长整形转字符串
- array_1.php
- //array_2d.php
- php代码优化
- PHP序列化/对象注入漏洞分析
- 在php中设置某个端口为特定项目
- 在php中设置某个端口为特定项目
- ThinkPHP Wamp二级域名配置设置
- php开发环境搭建