Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help : What'is the problem with my query?

Status
Not open for further replies.

AnggaLisdiyanto

Programmer
Sep 4, 2012
1
Assalamu'alaikum,


I've run this query in sql server and it's works. But not works in mysql at DBMS such as sqlyog and phpmyadmin. This is my query :

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
SELECT COUNT(mydate) AS number, CONVERT(VARCHAR(10), GETDATE(10) mydate, 101) AS mydate
FROM sale WHERE CONVERT(VARCHAR(10), mydate, 101) = CONVERT(VARCHAR(10), GETDATE(), 101)

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

And this is error message at mysql DBMS :
_________________________________________________________________________________

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 'VARCHAR(10), GETDATE(10) mydate, 101) AS mydate
FROM sale WHERE CONVERT(' at line 1
_________________________________________________________________________________

I hope there are anyone whocan help me. I would be very happy. Thankyou.
 
the answer is really simple -- sql server's CONVERT function does not exist in mysql

Code:
SELECT COUNT(mydate) AS number
  FROM sale 
 WHERE mydate >= CURRENT_DATE
   AND mydate  < CURRENT_DATE + INTERVAL 1 DAY

r937.com | rudy.ca
Buy my new book Simply SQL from Amazon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top