mysql - MSQL query for fetching data from three tables -


i have got 3 tables follows

  • achievement id, emp_id,area,dat

  • calls_per_day id, emp_id,noofcalls, hotcalls, hotleads, dat

  • sales_statistics_master id,emp_id, target, commitment,mnth, yrs

now want extract data of employee above 3 tables achievement, noofcalls, hotcalls,hotleads perday against monthly target , commitment.

i using following query.

select  a.area, s.target,s.commitment,c.noofcalls,c.hotcalls,c.hotleads    achievement a, sales_statistics_master s, calls_per_day c   a.dat=curdate() ,         c.dat=curdate() ,         s.yrs= year(now()) ,         a.emp_id=s.emp_id ,        a.emp_id=c.emp_id 

use join using(field).

select a.area, s.target,s.commitment,c.noofcalls,c.hotcalls,c.hotleads achievement join sales_statistics_master s using(emp_id) join calls_per_day c using(emp_id) a.dat=curdate() , c.dat=curdate() , s.yrs= year(now())  

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -