select m.*, c.NAME as CORP_NAME
from MAIL_LOG as m, CORP as c
where m.SEND_DATE >= '$term_from' and m.SEND_DATE <= '$term_end' ";
with
Select DISTINCT `TO_NAME_F_KANA` from MAIL_LOG group by m.SEND_DATE;
I like to get unique values from the first query with the TO_NAME_F_KANA as reference.
The following query should do the trick