PeterJ
Posts: 90
|
| Posted: 03/05/2005, 8:47 PM |
|
Hi
CCS returns an error when I use:
DATEDIFF(spdatestart, datestart) AS stScore
in the Data Source facility using SQL. This appears to be the correct argument. I presume DATEDIFF is a logical argument in CSS? Do the fields have to be date fields? I have them set as VARCHAR
Thanks
|
 |
 |
peterr
Posts: 5971
|
| Posted: 03/05/2005, 11:13 PM |
|
Please always provide the complete error message when you see an error! Without knowing details there is no way to know if CCS returns an error or your database or PHP.
Though I don't think that DATEDIFF exists in CCS thus if you use it you must construct correct SQL statement or PHP command that works without CCS.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
PeterJ
Posts: 90
|
| Posted: 03/06/2005, 3:02 AM |
|
Sorry, hanging my head in shame. Should have known better. The error was
"[MySQL][ODBC 3.51 Driver][mysqld-4.8.0nt] You have an error in your sql syntax. Check the manuak that corresponds to your MySQL server version for the rights syntaxt to use near (spdatestart, datestart) AS stScore FROM ((leaguechoices INNER"
|
 |
 |
peterr
Posts: 5971
|
| Posted: 03/06/2005, 12:12 PM |
|
Looks like this error is returned by MySQL. I found DateDiff example at http://dev.mysql.com/doc/mysql/en/date-and-time-functions.html
Hopefully it can help. Keep in mind that your SQL must work outside of CCS directly with MySQL, so it may be best to test it against MySQL.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
PeterJ
Posts: 90
|
| Posted: 03/07/2005, 12:25 AM |
|
I solved the calculation yesterday by using TO_DAYS(DATE1 - DATE2) as DATEDIFF doesn't work.
thanks for your assistance
|
 |
 |
DonB
|
| Posted: 03/07/2005, 6:34 AM |
|
DATEDIFF and other date-arithmetic functions were added as of MySQL 4.1.1.
Numerous other features have been added in this and other versions, so
always be aware of what version of MySQL your server is running.
--
DonB
http://www.gotodon.com/ccbth
"PeterJ" <PeterJ@forum.codecharge> wrote in message
news:5422c0ff95d5b0@news.codecharge.com...
> I solved the calculation yesterday by using TO_DAYS(DATE1 - DATE2) as
DATEDIFF
> doesn't work.
>
> thanks for your assistance
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |
PeterJ
Posts: 90
|
| Posted: 03/07/2005, 9:44 AM |
|
Hello DonB
Therein lies the problem. I'm using V3.23.49 locally and V4.0.22 remotely.
Thanks for pointing that out.
Thanks to peterr too. I have looked at the page as advised which reaffirms your point.
|
 |
 |
suzanna
|
| Posted: 03/20/2005, 7:32 PM |
|
hi..
sori my english so bad!!
my prob is to calculate the penalty if someone late send book..
how i want to compare dte date in database with the date today.
date from the database is date where d someone must send the book..
penalty=dateSEnd-dateToday
plzz
|
|
|
 |
PeterJ
Posts: 90
|
| Posted: 03/21/2005, 9:23 AM |
|
suzanna
Try MySQL Query:
(TO_DAYS(dateSEnd) - TO_DAYS(NOW())) AS penalty
and display the result as a label in your grid
|
 |
 |