SELECT * FROM logpm_distribution_signfor AS lds LEFT JOIN logpm_distribution_reservation AS ldr ON lds.reservation_id = ldr.id
SELECT
WHERE lds.delivery_id = #{deliveryId} AND (ldr.reservation_num + ldr.reservation_stock_list_num) > 0
lds.*
FROM
logpm_distribution_signfor AS lds
LEFT JOIN ( SELECT b.id,(b.reservation_num+b.reservation_stock_list_num) AS num FROM logpm_distribution_signfor AS a LEFT JOIN logpm_distribution_reservation AS b ON a.reservation_id = b.id GROUP BY a.reservation_id) AS t ON lds.reservation_id = t.id