Forum Moderators: open

Message Too Old, No Replies

MySQL function.DATE FORMAT does not exist

Query looks fine but mysql says date_format does not exist

         

Lee_Stevens

1:01 am on Feb 16, 2009 (gmt 0)

10+ Year Member



Here's the query:

SELECT
DATE_FORMAT (pj_start_date, '%Y-%m') AS 'Month'
,SUM (pj_paid_to_date) AS 'Project Total'
,(SELECT SUM (credit) AS 'Credit Total'
FROM tbl_finance
WHERE DATE_FORMAT (pj_start_date, '%Y-%m') = DATE_FORMAT (account_date, '%Y-%m'))
FROM tbl_projects pj

UNION

SELECT
DATE_FORMAT (tf2.account_date, '%Y-%m') AS 'Month'
,0
,SUM (tf2.credit) AS 'Credit Total'
FROM tbl_finance AS tf2
WHERE NOT EXISTS (
SELECT 1
FROM tbl_projects AS tp2
WHERE DATE_FORMAT (tp2.pj_start_date, '%Y-%m') = DATE_FORMAT (tf2.account_date, '%Y-%m') )

GROUP BY 'Month'

I carn't see anything wrong HELP

Here the error message:
#1305 - FUNCTION lees_pmnger.DATE_FORMAT does not exist

rocknbil

4:04 pm on Feb 18, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome aboard Lee_Stevens, tried to recreate the problem and encountered issues: we need to see your table structure for these queries (only the relevant tables and fields . . . )

tbarbedo

4:43 pm on Feb 27, 2009 (gmt 0)

10+ Year Member



Try to remove the space after DATE_FORMAT

DATE_FORMAT(date, format);

you have DATE_FORMAT (date, format)

not sure if this will fix it but it doesn't hurt to try :)