select a.product_id, a.customer_id, b.customer_name, b.customer_city, c.child_name, c.child_number, round(((datediff(current_date(), c.child_birthday)) / 30)) as UmurBln,
         (case when d.calling_result_id = '1' then 'Success'
                  when d.calling_result_id = '2' then 'Not Success' end) CallingResult,
         d.calling_strike_id
from product_log a, customer b, children c, calling d
where a.customer_id = b.customer_id and
          a.customer_id = c.customer_id and
          a.customer_id = d.customer_id and
          a.product_id = 'IF1' and
         round(((datediff(current_date(), c.child_birthday)) / 30)) between '0' and '2' and
         d.calling_result_id = '1' and d.calling_strike_id in ( '1', '10') and
         a.input_date <= '2010-09-17'
order by a.customer_id;

0 Comments:

Post a Comment