Hi
I have a requirement to display the count of sms,count of emails,count of click to call info from smsleads,email leads,clicktocallinfo tables based on ypid of company..that ypid belongs to ypinformation table...
i wrote the query like this
select Count(YPSmsLeads.SmsID) as smsleads ,Count(YPEmailLeads.EmailID) as emailleads,count(YPCallNowInfo.ID) as clicktocallinfo ,ypinformation.ypid,ypinformation.CompanyName from ypinformation inner join YPSmsLeads on YPSmsLeads.YPID=ypinformation.YPID inner join YPEmailLeads on YPEmailLeads.YPID=ypinformation.YPID inner join YPCallNowInfo on ypinformation.YPID=YPCallNowInfo.YPID where ypinformation.Category='testcat1' group by ypinformation.CompanyName,ypinformation.YPID
The problem is if individually runt the queries for count of smsleads as like this select COUNT(emailid) from YPEmailLeads where YPID=47482 it will showing as 4...it is correct...
but executing the above query it will be dispalying as 640 for all smsleads,emailleads,click tocall info....
Plz help me in writing the query perfectly
Regards,
Bhanu Prakash Bysani