select TOTAL from BC_HISTORY (SELECT date_format(LEFT(CAST(REQDT AS UNSIGNED),8),\'%Y-%m-%d\') AS REQDT, count(SVCE_DOMAIN) COUNTSV