thinkphp Correlation Query
Tour Line 1: Regiment 1: Price 1 (id,price ")
Price 2 (id,price ")
Group 2: Price 1 (id,price ")
Price 2 (id,price ")
I need to filter the group according to the Price field, the relationship model has been fitted, how to encapsulate the Where condition
Reply to discussion (solution)
It is recommended to look at the thinkphp documentation.
thinkphp document write too little only one-to-ones correlation query and does not involve the query based on the condition of the associated table and we often need to query according to the condition of the correlation criterion we do not know this where because how to encapsulate
I want to check the days in line for less than 5 days of regiment
$where ["line.days"] = Array ("ELT", "5"); This is wrong.
That's what I'm dealing with now.
$team = M ("team");
$where = "LineId in (select L.id from line L where L.days < 5)";
$list = $team->where ($where)->select ();
I feel like I'm in a lot of trouble now. There should be a better way to solve it. Ask the God for guidance
If the parent table is associated with a child table, you can directly connect the table by writing SQL.
Give the table structure to see
If the parent table is associated with a child table, you can directly connect the table by writing SQL.
Well, SQL solves it, but wants to know if there's a simple way to do it, like Hibernate, to thinkphp the field of a relational table as its own property.
If the parent table is associated with a child table, you can directly connect the table by writing SQL.
Well, SQL solves it, but wants to know if there's a simple way to do it, like Hibernate, to thinkphp the field of a relational table as its own property.
Then you write SQL directly through the thinkphp ORM.
If the parent table is associated with a child table, you can directly connect the table by writing SQL.
Well, SQL solves it, but wants to know if there's a simple way to do it, like Hibernate, to thinkphp the field of a relational table as its own property.
Then you write SQL directly through the thinkphp ORM.
Is the ORM configured in model? Can you tell me what I just did with PHP?
If the parent table is associated with a child table, you can directly connect the table by writing SQL.
Well, SQL solves it, but wants to know if there's a simple way to do it, like Hibernate, to thinkphp the field of a relational table as its own property.
Then you write SQL directly through the thinkphp ORM.
Is the ORM configured in model? Can you tell me what I just did with PHP?
You write operations directly in the controller SQL
Well, it seems there's no better way than to write SQL. Thank you for your advice.