Now have to retrieve conditions A, B, C Want is data and order (, because as long as 20)
At the same time satisfy A, B, C + At the same time satisfy A, B + Only meet A
Now I can think of is to use the union
The select... Where A and B and C The union The select... Where A and B The union The select... Where A
But the feeling is very low, there is a lot of duplicate data, with the union should slow efficiency
What's the idea? Otherwise, only partial time to retrieve the code
CodePudding user response:
Not as good as the data found out, the program for sorting, more quickly
CodePudding user response:
Do you want this? The select... Where (A and B and C) or (A and B) or (A)?
In fact, you retrieve A retrieved in the condition of data has been included (A and B and C) and (A and B), unless the condition is not the same as A, (B and C), (D and E and F),
CodePudding user response:
Query conditions, and then according to the three conditions, flag sorting before take 20 article is given
CodePudding user response:
Suggest to collect the data in the process of put in storage, if must be written to implement in a single statement, is poor efficiency will be some bad (data)