I have a stored procedure like below in MYSQL:
(SELECT 1 AS sort_col, col_a, col_b FROM t1 WHERE col_b LIKE %some% AND col_b LIKE %thing%)
UNION
(SELECT 2, col_a, col_b FROM t1 WHERE col_b LIKE %some% OR col_b LIKE %thing%)
ORDER BY sort_col, col_a;
I want the result of first select show at first, but some results of the first are common in second too, and second select changed their sort_col to 2.(I can't use LIMIT
in my selects)
what can I do for solve it?