thinkphp 3.2 join
$res2 = M('stat_info a')
->join(C('DB_PREFIX').'stock b ON a.goods_id = b.goods_id')
->field('a.*,b.goods_sn,b.goods_name,b.goods_barcode')
->select(); $res2 = M('stat_info a')
->join(__STOCK__.' b ON a.goods_id = b.goods_id')
->field('a.*,b.goods_sn,b.goods_name,b.goods_barcode')
->select(); $res = M('stat_info a')
->join('__STOCK__ b ON a.goods_id = b.goods_id')
->field('a.*,b.goods_sn,b.goods_name,b.goods_barcode')
->where('a.stat_id='.$id)
->select();
两种方法都可以
$res = M('stat_info a')
->join('__STOCK__ b ON a.goods_id = b.goods_id')
->join('__DEPOT__ C ON b.depot_id = c.id')
->field('a.*,b.goods_sn,b.goods_name,b.goods_barcode,c.depot_name')
->where('a.stat_id='.$id)
->select();
thinkphp 3.2 join的更多相关文章
- php总结回顾
做人不能一直埋着头往前跑,还要偶尔停下来看下来时的路.所以今天就来回顾下之前的吧 下面依次介绍 [一]TP加载流程 ①应用入口文件index.php→②tp公共入口文件ThinkPHP.php→③核心 ...
- ThinkPHP---TP功能类之联表查询
[一]介绍 在原生的sql中使用join 语法进行数据的联表查询, 在ThinkPHP里支持联表查询操作,但是可以归纳成两种方式:table方法.join方法 (1)table方法:在TP中对应SQL ...
- ThinkPHP join() table()方法的使用,多表查询
ThinkPHP模型类比较常用的两个方法,table() join() table 1 $list = M()->table('user1 a, user2 b')->where('a. ...
- thinkphp join 查询
$user=M('user')->table(C('DB_PREFIX').'user as a')->join(C('DB_PREFIX').'role_user as b on a.u ...
- Thinkphp join 连接查询
public function test ( ) { $User = M('authlist'); $rs = $User->join('left join wifi_shop on wifi_ ...
- ThinkPHP第十六天(redirect、join、视图模型)
1.redirect /** * Action跳转(URL重定向) 支持指定模块和延时跳转 * access protected * @param string $url 跳转的URL表达式 * @p ...
- ThinkPHP第十天(_initialize方法,SESSION销毁,分组配置,include文件引入,JOIN用法)
1.Action类中的_initialize()函数,先于任何自定义操作函数运行,可认为是控制器的前置操作.可用于检测用户是否登录等检测. 如果多个模块(Action)需要相同_initialize( ...
- thinkphp join加别名
//此段代码在某个Model里面$tbpre = $this->tableprefix;$Aaa = M('aaa');$Aaa->table(array("{$tbpre}aa ...
- thinkphp join 表前缀
public function get_user_group_title($uid){ $pre = C('DB_PREFIX'); $res = M('AuthGroupAccess aga')-& ...
随机推荐
- Java文件中出现这样的提示错误与解决方法:Cannot return from outside a function or method?
1.打开 >> Myeclipse或Eclipse.(我使用的是Myeclipse) 2.打开 >> Window >> Preferences 如图 ...
- 腾讯云CentOS系统配置apache和tomcat
本文使用yum软件包管理工具基于CentOS7.2版本配置apache和tom. 云服务器选购完毕后,安装Xshell软件,输入用户名密码即可远程登陆登录(centos用户名默认是root). 1,下 ...
- Linux之od命令详解
功能说明:输出文件内容.语 法:od [-abcdfhilovx][-A <字码基数>][-j <字符数目>][-N <字符数目>][-s <字符串字符数&g ...
- ajax 允许跨域html头设置
"Access-Control-Allow-Origin"= "*" "Access-Control-Allow-Headers"= &qu ...
- openssl、x509、crt、cer、key、csr、ssl、tls 这些都是什么鬼?
今天尝试在mac机上搭建docker registry私有仓库时,杯具的发现最新的registry出于安全考虑,强制使用ssl认证,于是又详细了解linux/mac上openssl的使用方法,接触了一 ...
- [LeetCode] Find All Numbers Disappeared in an Array 找出数组中所有消失的数字
Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and ot ...
- [LeetCode] Arithmetic Slices 算数切片
A sequence of number is called arithmetic if it consists of at least three elements and if the diffe ...
- [LeetCode] Number of Connected Components in an Undirected Graph 无向图中的连通区域的个数
Given n nodes labeled from 0 to n - 1 and a list of undirected edges (each edge is a pair of nodes), ...
- [LeetCode] Two Sum 两数之和
Given an array of integers, return indices of the two numbers such that they add up to a specific ta ...
- Ubuntu下基于Saprk安装Zeppelin
前言 Apache Zeppelin是一款基于web的notebook(类似于ipython的notebook),支持交互式地数据分析,即一个Web笔记形式的交互式数据查询分析工具,可以在线用scal ...