I have a table tine_by_day
and I know how to use TO_CHAR
function in oracle
, but how to get same output if I use in MySQL
?
Is there any conversion function in MySQL
for TO_CHAR()
?
I have already tried date_format
instead to_char
but I'm not getting sufficient results.
SELECT
to_char(t.the_date,'mm-DD-YYYY') Date,
SUM(sf7.unit_sales) UnitSales,
SUM(sf7.store_sales) StoreSales,
SUM(sf7.store_cost) StoreCost
FROM time_by_day t INNER JOIN sales_fact_1997 sf7 ON t.time_id=sf7.time_id
WHERE
to_char(t.the_date,'YYYY-MM-DD')>='2012-01-01'
AND
to_char(t.the_date,'YYYY-MM-DD')<='2012-01-07'
GROUP BY t.the_date
ORDER BY t.the_date