CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge -> Programming

 Where clause with date comparison??

Print topic Send  topic

Author Message
Manarak

Posts: 10
Posted: 07/10/2004, 3:07 AM

Hello

I am working with php and mysql.
I have a table with the following fields:

last_contact (Mysql date format)
interv_time (mysql big integer format)

I would like to display only the records where
the number of days between the last_contact and the current date is greater than interv_time

can someone please help me to convert this into something codecharge or mysql understands? Ideally I would like to insert this into the "where" tab on codecharge.

thank you in advance
View profile  Send private message
Manarak

Posts: 10
Posted: 07/10/2004, 3:12 AM

1st unsuccessful trial:

Database error: Invalid SQL: select c.1name as c_1name, c.2name as c_2name, c.birthday as c_birthday, c.cid as c_cid, c.last_contact as c_last_contact from contacts c WHERE intval(strtotime(CURDATE())-strtotime(last_contact))/86400>interv_time
MySQL Error: 1064 (You have an error in your SQL syntax near '(strtotime(CURDATE())-strtotime(last_contact))/86400>interv_time' at line 1)
Session halted.
View profile  Send private message
Manarak

Posts: 10
Posted: 07/10/2004, 3:16 AM

I run Mysql 3.23
View profile  Send private message
Manarak

Posts: 10
Posted: 07/10/2004, 3:18 AM

2nd unsuccessful try:

Database error: Invalid SQL: select c.1name as c_1name, c.2name as c_2name, c.birthday as c_birthday, c.cid as c_cid, c.last_contact as c_last_contact from contacts c WHERE datediff(CURDATE(),last_contact)>interv_time
MySQL Error: 1064 (You have an error in your SQL syntax near '(CURDATE(),last_contact)>interv_time' at line 1)
Session halted.

probalby because I don't run MySQL 4.1.1 or greater?
View profile  Send private message
Manarak

Posts: 10
Posted: 07/10/2004, 3:21 AM

This one worked:

to_days(curdate())-to_days(last_contact)>interv_time

no help needed!
View profile  Send private message
Walter Kempees
Posted: 07/20/2004, 6:46 AM

Good job,
Walt
"Manarak" <Manarak@forum.codecharge> schreef in bericht
news:1440efc33a5b8d2@news.codecharge.com...
> This one worked:
>
> to_days(curdate())-to_days(last_contact)>interv_time
>
> no help needed!
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>


Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.