我有一张表tine_by_day,我知道如何使用TO_CHARin 函数oracle,但是如果我使用 in ,如何获得相同的输出MySQL?
MySQLfor中是否有任何转换功能TO_CHAR()?
我已经尝试过date_format了,但to_char我没有得到足够的结果。
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