select `cars`.*, (selectcount(*) from `car_favorites` where `cars`.`id` = `car_favorites`.`car_id` and `car_favorites`.`deleted_at` isnull) as `favorite_count`, (selectcount(*) from `user_visit_cars` where `cars`.`id` = `user_visit_cars`.`car_id` and `user_visit_cars`.`deleted_at` isnull) as `user_visit_car_count` from `cars` where (`status` =1) and `cars`.`id` =4120and `cars`.`deleted_at` isnull limit 1
selectsum(`user_visit_car_count`) as aggregate from (select `cars`.*, (selectcount(*) from `user_visit_cars` where `cars`.`id` = `user_visit_cars`.`car_id` and `user_visit_cars`.`deleted_at` isnull) as `user_visit_car_count` from `cars` where `status` =1and `deleted_at` isnulland `cars`.`deleted_at` isnullhaving `user_visit_car_count` >0) as `temp_table`
selectcount(*) as aggregate from (select `cars`.*, (selectcount(*) from `user_visit_cars` where `cars`.`id` = `user_visit_cars`.`car_id` and `user_visit_cars`.`deleted_at` isnull) as `user_visit_car_count` from `cars` where `status` =1and `deleted_at` isnulland `cars`.`deleted_at` isnullhaving `user_visit_car_count` >0) as `temp_table`
selectcount(*) as aggregate from `user_visit_cars` where `user_visit_cars`.`car_id` =4120and `user_visit_cars`.`car_id` isnotnulland `user_visit_cars`.`deleted_at` isnull