我收到错误Lost connection to MySQL server during query
时出现UNION
查询。
select *
from `dealers`
where exists ((
select *
from `cars`
where `dealers`.`id` = `cars`.`dealer_id`
and exists (select *
from `dealers`
where `cars`.`dealer_id` = `dealers`.`id`)
and `dealer_id` = 27
order by `price` asc)
union (select *
from `cars`
where `dealers`.`id` = `cars`.`dealer_id`
and exists (select *
from `dealers`
where `cars`.`dealer_id` = `dealers`.`id`)
and `dealer_id` != 27
order by `price` desc))
order by `dealers`.`name` asc
奇怪的是,如果我完全删除最后一行,或者我按id
而不是name
排序,则可以正常工作。
任何想法都可能出错?