1 For example, I want to price in 20-30 50-60 70-80 price range of goods, the relationship is or
2 at the same time, the title should include skirts, tops, coats, or
3 also exclude the title contains children's wear, books, relations for and,
3 result merges are sorted by ID and then the data is fetched.
Probably similar to the following MySQL statement
(Price range 1 or price range 2 or price range 3) and (Heading 1 or Heading 2 or Heading 3) and (title not in (...)) Order by ID
And then thinkphp how to use his chain operation to express, especially inside the complex nested query conditions? Or what kind of approach is generally used?
Reply content:
1 For example, I want to price in 20-30 50-60 70-80 price range of goods, the relationship is or
2 at the same time, the title should include skirts, tops, coats, or
3 also exclude the title contains children's wear, books, relations for and,
3 result merges are sorted by ID and then the data is fetched.
Probably similar to the following MySQL statement
(Price range 1 or price range 2 or price range 3) and (Heading 1 or Heading 2 or Heading 3) and (title not in (...)) Order by ID
And then thinkphp how to use his chain operation to express, especially inside the complex nested query conditions? Or what kind of approach is generally used?
thinkphp where () is very useful, can be passed the form of the array of conditions, object form, can also be multiple parameters together, you can also accept the native SQL where part of the statement. That is, where (' (Price range 1 or price range 2 or price range 3) and (Heading 1 or Heading 2 or Heading 3) and (title not in (...)) ') so it is possible, if this can not meet you, you can complete the $this->quer Y () [M (' XXX ')->query ()] to execute a native SQL
What you need is a combination query in thinkphp.
_string _logic _complex These kinds of usage can be satisfied.