(SELECT COUNT(sn) FROM device WHERE apply.`app_id` = device.`app_id`) deviceCount
FROM USER LEFT JOIN apply ON user.user_id = apply.user_id
where 1=1
SELECT user.user_id, user_name, PASSWORD, company, user.create_time, user.update_time ,COUNT(device.`device_id`) deviceCount FROM USER LEFT JOIN apply ON user.user_id = apply.user_id LEFT JOIN device ON apply.app_id = device.app_id