SELECT COUNT(*) FROM customer WHERE provider_id = "aaa"; // ܖຖͷbilling_itemͷquantity૯ΛͱΔ > SELECT provider_id, COUNT(*) FROM customer GROUP BY provider_id;
SELECT * FROM ${ू߹} WHERE aa=“xx” ), tableB as ( SELECT * FROM ${ू߹} WHERE aa=“xx” ) SELECT ${ू߹ͷཁૉ} FROM tableA XXX JOIN tableB ON ${ू߹ͷཁૉʹΑΔ݅} WHERE ${ू߹ͷཁૉʹΑΔ݅}
FROM ( SELECT provider_id, COUNT(*) as this_year_begin_num FROM contract WHERE DATE_FORMAT(contract_begin_date, “%Y”) = DATE_FORMAT(now(), “%Y”) ) m LEFT JOIN ( SELECT provider_id, COUNT(*) as this_month_begin_num FROM contract WHERE DATE_FORMAT(contract_begin_date, “%Y-%M”) = DATE_FORMAT(now(), “%Y-%M”) ) y ON m.provider_id = y.provider_id