How to Use alias for database operations of thinkPHP? Parameter types supported by coherent operations
Alias is used to define an alias string for the current data table.
How to use the thinkPHP operation method alias, do not write the original SQL statement
Is alias missing in thinkPHP development documentation? My development document is thinkPHP3.1.2.
Reply to discussion (solution)
Please comply with the CSDN user code of conduct and shall not violate national laws and regulations.
Http://www.thinkphp1.cn/simple/quickstart_4.html
Alias is used to set the alias of the current data table to facilitate other consistent operations, such as the join method. Example: $ Model = M ('user'); $ Model-> alias ('A')-> join ('_ DEPT _ B ON B. user_id =. ID')-> select (); the final SQL statement is similar to: SELECT * FROM think_user a inner join think_dept B ON B. user_id =. id
Http://document.thinkphp1.cn/manual_3_2.html#alias
Alias is used to set the alias of the current data table to facilitate other consistent operations, such as the join method. Example: $ Model = M ('user'); $ Model-> alias ('A')-> join ('_ DEPT _ B ON B. user_id =. ID')-> select (); the final SQL statement is similar to: SELECT * FROM think_user a inner join think_dept B ON B. user_id =. id
Http://document.thinkphp1.cn/manual_3_2.html#alias
That is similar to this native SQL
Select count (*) from (select * from user where userId> 10) as a; alias a for a query result set and count
How should I write thinkPHP?