当前位置:网站首页>Thinkphp5 multi table associative query method join queries two database tables, and the query results are spliced and returned
Thinkphp5 multi table associative query method join queries two database tables, and the query results are spliced and returned
2022-07-06 22:47:00 【Dehong eye inserting demon king】
Database only
Want to achieve :
Code up :
public function demo()
{
// With shop Main table
$res = Db::table('shop')
->alias("a") // Take an alias
// And shop_class Tables are associated , The name i, also a Tabular shop_class Field equals i Tabular class_code Field
// Table 1 and table 2 are the same :'a.shop_class = i.class_code'
->join('shop_class i', 'a.shop_class = i.class_code')
->field('a.id,a.shop_name,a.shop_price,a.shop_details,i.class_name,a.shop_src,a.shop_xq_src1,a.shop_xq_src2,a.shop_xq_src3,a.good_unit,a.good_parameter,a.good_specs_code')
// Query required fields field()
->select();
//->paginate(10);// If you need to add this paragraph by page
var_dump($res);
}
边栏推荐
- NPDP certification | how do product managers communicate across functions / teams?
- General implementation and encapsulation of go diversified timing tasks
- cuda 探索
- DR-Net: dual-rotation network with feature map enhancement for medical image segmentation
- MATLAB小技巧(27)灰色预测
- Aardio - integrate variable values into a string of text through variable names
- 【踩坑合辑】Attempting to deserialize object on CUDA device+buff/cache占用过高+pad_sequence
- Aardio - 封装库时批量处理属性与回调函数的方法
- Void keyword
- 2022-07-05 use TPCC to conduct sub query test on stonedb
猜你喜欢
Aardio - Method of batch processing attributes and callback functions when encapsulating Libraries
2022-07-04 the high-performance database engine stonedb of MySQL is compiled and run in centos7.9
Motion capture for snake motion analysis and snake robot development
Financial professionals must read book series 6: equity investment (based on the outline and framework of the CFA exam)
Improving Multimodal Accuracy Through Modality Pre-training and Attention
CUDA exploration
专为决策树打造,新加坡国立大学&清华大学联合提出快速安全的联邦学习新系统
Cloud native technology container knowledge points
UE4 blueprint learning chapter (IV) -- process control forloop and whileloop
CocosCreator+TypeScripts自己写一个对象池
随机推荐
TypeScript获取函数参数类型
UDP programming
That's why you can't understand recursion
void关键字
柔性数组到底如何使用呢?
C three ways to realize socket data reception
MySQL----初识MySQL
Sword finger offer question brushing record 1
Detailed explanation of ThreadLocal
OpenSSL:适用TLS与SSL协议的全功能工具包,通用加密库
UVa 11732 – strcmp() Anyone?
Extern keyword
欧洲生物信息研究所2021亮点报告发布:采用AlphaFold已预测出近1百万个蛋白质
Motion capture for snake motion analysis and snake robot development
自定义 swap 函数
关于声子和热输运计算中BORN电荷和non-analytic修正的问题
专为决策树打造,新加坡国立大学&清华大学联合提出快速安全的联邦学习新系统
Aardio - does not declare the method of directly passing float values
Chapter 19 using work queue manager (2)
View