Jump to content

Date Formatting (again)


Nodral

Recommended Posts

Hi All

 

Any ideas what is wrong with this query?

 

SELECT count(*) as number WHERE ed = 429 AND YEAR(StartDate) = '2007'

 

Data is as below

 

ID            ED          CourseName                                            StartDate

1405 429 In Search of Promoters                 2011-02-01 10:00:00

1406 429 Managing the Customer Experience 2011-02-15 09:30:00

1407 635 Driver Awareness                                 2009-12-08 09:00:00

1408 635 Time Management                                 2007-03-23 10:00:00

1409 635 Fleet Administration                                 2005-04-13 10:00:00

1410 635 Coaching and Counselling Skills 2004-04-06 10:00:00

 

Error Code: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE ed = 429 AND YEAR(StartDate) = '2007'' at line 1

 

Link to comment
Share on other sites

Sorry guys, been a long day (and getting longer!!)

 

Now, same table, why doesn't this work?

 

SELECT coursename, DATE_FORMAT('startdate', %D, %M, %Y) as start FROM courses WHERE ed = 429 AND startdate > '2007-01-01' ORDER BY startdate

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.