Looking for a way to use models to perform multi-table related queries under TP5?
阳光
阳光 2018-10-10 08:44:29
0
4
1832

Dear masters, when I use tp5 to query multiple tables, I use the view query method, similar to Db::view('table_a')->view('table_b')-> view('table_c')->view('table_d')->view('table_e')->select(). If you want to use model classes to do this, it is similar to many What method should be used to perform related queries on tables (more than 5)? Do we need to create an inter-table association model for each table and then string them together for use? Thank you!

阳光
阳光

reply all(4)
Autumn

DB::table('Table1') ->alias('a')    ->field(")    ->where( $where)    ->join('data table d','a.id=d.id','left')   &nbsp ;->join('')    ->join('')    ->order('' )    ->page()    -> select(); In this way, no matter how many tables you have, you can join them

*

Does anyone know the steps and principles of creating and installing a PHP website? Can you please explain? ? ?

*

PHP website creation and installation procedure steps and principles

Don't cry

Generally speaking, it is rarely used to query the five tables you mentioned. If necessary, it is mostly because there is a problem with your business logic or database design. Don't worry too much about this issue

  • reply Thank you very much for the reminder, thank you
    阳光 author 2018-10-10 12:18:36
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!