• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

datepart error

 
bubu lina
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello
trying to extract the year from a date database field, i keep on getting sql error:
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 'DATEPART (year, '2007-06-01')' at line 1


this is what i am trying..and not succeeding...:


i am sure this is wrong... but i don't know the correct syntax for this.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65229
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"low range", two things:

1) Please check your private messages for an important administrative matter.

2) Please use real words when posting to the forums. Abbreviations such as "err" in place of "error" only serve to make your posts more difficult to read and less likely to generate useful responses.

Please read this for more information.

thanks,
bear
JavaRanch sheriff
 
Jan Cumps
Bartender
Posts: 2602
13
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is DATEPART supported by mysql?
I did not find it documented in the reference.
They do have a YEAR() function though.

Regards, Jan
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic