Reputation: 55584
I have installed WampServer 2.0 with MySQL 5.1.33.
I can do Numeric and String functions like
SELECT ABS(-2)
orSELECT LOWER('ASD')
but with Date and Time Functions such as
SELECT CURDATE()
orSELECT NOW()
I get
Error : no such function: CURDATE
Am I doing something wrong, is there anything I need to install?
Any help about where to start investigating?
Upvotes: 7
Views: 13516
Reputation: 1
If SQLite had the same features as SQL, it would be amazing. But fortunately for query types with date comparisons it is possible to use existing SQLite functions.
An example of how I was able to carry out my query was as follows: Using an interface type class declaring my ObjectDAO: 'PartidoDAO'.
@Query("select * from partido where fpartido>=DATE() and epartido = 'Santiago Bernabeu' ORDER BY fpartido LIMIT 1")
Partido getMoreRecentPartido();
If you want more information about functions related to date data types consult the web I invite you to consult this resource. SQLite Date Functions.
Upvotes: 0
Reputation: 11
Many functions are different in SQlite and in MySQL (or any other product - if you except core functions, most functions provide the same functionality but with a different syntax). There is an open-source "compatibility library" implementing a large number of MySQL functions in SQLite on the Kansas State University CIS website
Upvotes: 1
Reputation: 562631
There is no error message from MySQL with the text "No such function." I just did a grep on the whole source tree of MySQL 5.1, and that string does not occur anywhere (except in one comment).
My thought is that you aren't using MySQL, you're using SQLite. Because I can reproduce that error when I run the SQLite command-line shell:
$ sqlite3
sqlite> select curdate();
Error: no such function: curdate
sqlite> select now();
Error: no such function: now
In SQLite, the function to get the current date is simply date()
:
sqlite> select date();
2010-01-02
Upvotes: 20
Reputation: 7281
My inclination is to run a mysql repair install. if that didn't work, then i'd try to wamp reinst.
Upvotes: 0