Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Not a Bug
-
None
-
None
Description
The following query does not return a syntax error, but it seems like it should:
select * from mytest ORDER BY score DESC, individual_id AND service_id=1; |
REPO:
create table mytest ( |
individual_id int(11), |
score int(11), |
service_id int(11) |
);
|
|
insert into mytest |
values (1, 10, 5), (2, 11, 5), (3, 12, 2), (4, 20, 2), |
(5, 21, 1), (6, 22, 1), (7, 30, 1), (8, 31, 4),
|
(9, 32, 6);
|
|
select * from mytest |
ORDER BY score DESC, individual_id AND service_id=1; |
+---------------+-------+------------+
|
| individual_id | score | service_id |
|
+---------------+-------+------------+
|
| 9 | 32 | 6 |
|
| 8 | 31 | 4 |
|
| 7 | 30 | 1 |
|
| 6 | 22 | 1 |
|
| 5 | 21 | 1 |
|
| 4 | 20 | 2 |
|
| 3 | 12 | 2 |
|
| 2 | 11 | 5 |
|
| 1 | 10 | 5 |
|
+---------------+-------+------------+
|