For the two sentences of "or" SQL ", how does the ike sort data by the like sequence? Name LIKE "% A %" OR time LIKE "% B %"
How can I finish the result of like A in B?
Reply to discussion (solution)
... Order by if (instr (name, 'A')> 0, 0) desc
... Order by if (instr (name, 'A')> 0, 0) desc
Do you have a full sentence example? I cannot understand such a sentence!
This half sentence is understandable.
That is to say, convert the string containing 'a' to 0, 1, and sort the string by 01. the string contains 1, and the string that does not contain 0.
The final sorting is order by if (instr (name, 'A')>, 0) desc
This half sentence is understandable.
That is to say, convert the string containing 'a' to 0, 1, and sort the string by 01. the string contains 1, and the string that does not contain 0.
The final sorting is order by if (instr (name, 'A')>, 0) desc
The actual arrangement result I want is probably the following statement, which sorts the data in two parentheses in sequence, first in the first bracket, in the row of 2nd brackets ....
SELECT * from cs where (time like "" % a % or name like "% B %" or time like "% e % ") or (time like "" % 11% or name like "% 22%" or time like "% 33% ")
The same. I used the same statement in the preceding statement. I can't even understand it?
Order by if (instr (name, 'A')> 0, 1, (if (instr (name, 'B')> 0, 1, (if (instr (name, 'E')> 0, 1) desc