Help on Count function

Posted by Vijayar under ASP.NET on 6/16/2011 | Points: 10 | Views : 1954 | Status : [Member] | Replies : 1
Hi


I have 3 tables called Rc NewApplicants,uploadscvfile and sourcemaster
RcNewapplicant------>applicantid,datasourceid
Uploadcsv-----> uploadcsvid,datasourceid
Sourcemaster---->DataSourcename,commitment

My Requirement is
i want to get the count of applicantid,uploadcsvid and calculate the sum of applicantid,uploadcsvid and group theim by using datasourceid and display the datasourcename from sourcemaster,calaculate the difference between total(i.e sum obtained by grouping) and commitment.Please Help me in this issue.it;s very urgent

vijaya


Responses

Posted by: Robin_ahuja2008 on: 6/17/2011 [Member] Starter | Points: 25

Up
0
Down
use you use the count and sum function of sql like

SELECT COUNT(DISTINCT applicantid),COUNT(DISTINCT uploadcsvid),SUM(applicantid),SUM(uploadcsvid),applicantid,uploadcsvid

GROUP BY applicantid,uploadcsvid


Now, use the Sub-Query concept to get your output

SELECT YOUR_COLUMNS FROM
(
SELECT COUNT(DISTINCT applicantid),COUNT(DISTINCT uploadcsvid),SUM(applicantid),SUM(uploadcsvid),applicantid,uploadcsvid
GROUP BY applicantid,uploadcsvid
)


Regards,
Robin Ahuja

Vijayar, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response