Page 1 of 1

Filter problem with DATE_OF_BIRTHDAY

PostPosted: Fri Jul 24, 2009 9:57 am
by phil_discount
Hello,

i'd like to filter the leads in the hopper by birthday.
but i don't know how to do that.

in the sql database the field named DATE_OF_BIRTHDAY.

my request:

only leads with birthday of today or before should be phoned.
the first leads should be the customers with the birthday today and then every customer who had birthday in the past.

DATE_OF_BIRTHDAY <= now() GROUP BY DATE_OF_BIRTHDAY

is it possible, if yes, how? ;-)

thanks a lot
best regards
philip

PostPosted: Fri Jul 24, 2009 11:07 am
by phil_discount
UPDATE:

i found out, that the syntax have to
Code: Select all
date_of_birth < today

format in datebase for field "date_of_birth"
Code: Select all
2009-07-26

PostPosted: Wed Aug 05, 2009 7:34 am
by phil_discount
okay, problem is solved.
my code was wrong
useful help is /usr/share/astguiclient/AST_VDhopper.pl --debugX
:-)

i use the following code
Code: Select all
day(date_of_birth) <= day(now())
AND
month(date_of_birth) <= month(now())
AND
month(now()) - month(date_of_birth) <= 1


regards
philip

PostPosted: Wed Aug 05, 2009 2:39 pm
by phil_discount
is it possible to order the result of the filter like
Code: Select all
ORDER BY date_of_birth


log from debug

Code: Select all
','-11.75','-12.00','-12.25','-12.50','-12.75','99') ) ) and day(date_of_birth) <= day(now())
AND
month(date_of_birth) <= month(now())
AND
month(now()) - month(date_of_birth) <= 1 ORDER BY date_of_birth limit 50;|
     lead call order:      order by lead_id asc
     |SELECT lead_id,list_id,gmt_offset_now,phone_number,state,status,modify_date,user FROM vicidial_list where called_since_last_reset='N' and status IN('NEW') and list_id IN('102') and lead_id NOT IN('0') and ((gmt_offset_now IN('13.00','12.75','12.50','12.25','12.00','11.75','11.50','11.25','11.00','10.75','10.50','10.25','10.00','9.75','9.50','9.25','9.00','8.75','8.50','8.25','8.00','7.75','7.50','7.25','7.00','6.75','6.50','6.25','6.00','5.75','5.50','5.25','5.00','4.75','4.50','4.25','4.00','3.75','3.50','3.25','3.00','2.75','2.50','2.25','2.00','1.75','1.50','1.25','1.00','0.75','0.50','0.25','0.00','-0.25','-0.50','-0.75','-1.00','-1.25','-1.50','-1.75','-2.00','-2.25','-2.50','-2.75','-3.00','-3.25','-3.50','-3.75','-4.00','-4.25','-4.50','-4.75','-5.00','-5.25','-5.50','-5.75','-6.00','-6.25','-6.50','-6.75','-7.00','-7.25','-7.50','-7.75','-8.00','-8.25','-8.50','-8.75','-9.00','-9.25','-9.50','-9.75','-10.00','-10.25','-10.50','-10.75','-11.00','-11.25','-11.50','-11.75','-12.00','-12.25','-12.50','-12.75','99') ) ) and day(date_of_birth) <= day(now())
AND
month(date_of_birth) <= month(now())
AND
month(now()) - month(date_of_birth) <= 1 ORDER BY date_of_birth order by lead_id asc limit 50;|
DBD::mysql::st execute failed: 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 'order by lead_id asc limit 50' at line 5 at /usr/share/astguiclient/AST_VDhopper.pl line 1351.
executing: SELECT lead_id,list_id,gmt_offset_now,phone_number,state,status,modify_date,user FROM vicidial_list where called_since_last_reset='N' and status IN('NEW') and list_id IN('102') and lead_id NOT IN('0') and ((gmt_offset_now IN('13.00','12.75','12.50','12.25','12.00','11.75','11.50','11.25','11.00','10.75','10.50','10.25','10.00','9.75','9.50','9.25','9.00','8.75','8.50','8.25','8.00','7.75','7.50','7.25','7.00','6.75','6.50','6.25','6.00','5.75','5.50','5.25','5.00','4.75','4.50','4.25','4.00','3.75','3.50','3.25','3.00','2.75','2.50','2.25','2.00','1.75','1.50','1.25','1.00','0.75','0.50','0.25','0.00','-0.25','-0.50','-0.75','-1.00','-1.25','-1.50','-1.75','-2.00','-2.25','-2.50','-2.75','-3.00','-3.25','-3.50','-3.75','-4.00','-4.25','-4.50','-4.75','-5.00','-5.25','-5.50','-5.75','-6.00','-6.25','-6.50','-6.75','-7.00','-7.25','-7.50','-7.75','-8.00','-8.25','-8.50','-8.75','-9.00','-9.25','-9.50','-9.75','-10.00','-10.25','-10.50','-10.75','-11.00','-11.25','-11.50','-11.75','-12.00','-12.25','-12.50','-12.75','99') ) ) and day(date_of_birth) <= day(now())
AND
month(date_of_birth) <= month(now())
AND
month(now()) - month(date_of_birth) <= 1 ORDER BY date_of_birth order by lead_id asc limit 50; 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 'order by lead_id asc limit 50' at line 5 at /usr/share/astguiclient/AST_VDhopper.pl line 1351.


i see, that there is already an order statement "order by lead_id asc limit 50"...
i want to remove the "order by lead_id", can i do that?

PostPosted: Wed Aug 05, 2009 6:59 pm
by lerroux
i'd suggest you try it if it works. but back everything thing up so you dont f*** up your system

cheers,
lerroux

PostPosted: Thu Aug 06, 2009 12:25 am
by phil_discount
in which file i have to remove the "order by lead_id"?

PostPosted: Thu Aug 06, 2009 9:51 am
by lerroux
just guessing since you debugged this file:

/usr/share/astguiclient/AST_VDhopper.pl

still be careful though......

PostPosted: Fri Aug 07, 2009 2:28 am
by phil_discount
thanks a lot,
i changed one order choice and removed the "order by lead_id asc"
it works fine!

Regards
Philip

PostPosted: Fri Aug 07, 2009 12:23 pm
by lerroux
no problem...