Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MySQL Datetime fields
Message
From
28/09/2007 11:40:48
 
 
To
27/09/2007 20:34:15
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
01257348
Message ID:
01257469
Views:
17
>In a MySQL table we have a DATETIME field AuditDate.
>
>I want to pull records from that table for a specific date
>ldDate = DATE()
>=SQLEXEC(lnHandle,"SELECT * from mytable WHERE DATE(AuditDate) = ?ldDate")
>
>Unfortunately, this pulls zero records. I know there are records for this date
>ldDate = DATE()
>=SQLEXEC(lnHandle,"SELECT AuditDate,DATE(AuditDate) ddd FROM myTable")
>SELECT * FROM sqlresult WHERE TTOD(AuditDate) = ldDate ---> 171 records
>SELECT * FROM sqlresult WHERE ddd = lddate ---> 171 records
>
>Can someone give me the proper syntax for getting a MySQL datetime field using a parameter.
>
>Muchly appreciated...............Rich


DATE(AuditDate) returns "2007-05-12", so you need to convert date paramater to same format.

Try ldDate = LEFT(TTOC(DATE(),3),10)
Previous
Reply
Map
View

Click here to load this message in the networking platform