Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


how to do sum the salarie of employes if empnames are equal in ssis


how to do sum the salarie of employes if empnames are equal in ssis

Author
Message
jeevan.gumpu
jeevan.gumpu
Grasshopper
Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)

Group: General Forum Members
Points: 24 Visits: 95
Hi All,

if employee names in a table are equal then that particular employees salary should be add total, Here i am giving one simple example:

input table is as below:
EmpID, EmpName, Salary
123, andy, 10000
111, Maddy, 12000
121, Raman, 25000
124, Hemanth, 40000
133, krishna, 50000
122, andy, 20000
134, Raman, 60000
143, Maddy, 30000

the output should be like:

EmpID, EmpName, Salary
123, andy, 10000
122, andy, 20000
143, Maddy, 30000
111, Maddy, 12000
121, Raman, 25000
134, Raman, 60000
124, Hemanth, 40000
133, krishna, 50000

EmpName, Salary
andy, 30000
Maddy, 42000
Raman, 85000
Hemanth, 40000
krishna, 50000
LutzM
LutzM
SSCertifiable
SSCertifiable (7K reputation)SSCertifiable (7K reputation)SSCertifiable (7K reputation)SSCertifiable (7K reputation)SSCertifiable (7K reputation)SSCertifiable (7K reputation)SSCertifiable (7K reputation)SSCertifiable (7K reputation)

Group: General Forum Members
Points: 7001 Visits: 13559
Looks like homework... You might want to look into aggregation task or GROUP BY in TSQL.



Lutz
A pessimist is an optimist with experience.

How to get fast answers to your question
How to post performance related questions
Links for Tally Table , Cross Tabs and Dynamic Cross Tabs , Delimited Split Function
bitbucket-25253
bitbucket-25253
SSCertifiable
SSCertifiable (5.7K reputation)SSCertifiable (5.7K reputation)SSCertifiable (5.7K reputation)SSCertifiable (5.7K reputation)SSCertifiable (5.7K reputation)SSCertifiable (5.7K reputation)SSCertifiable (5.7K reputation)SSCertifiable (5.7K reputation)

Group: General Forum Members
Points: 5689 Visits: 25280
Here is a GROUP BY solution

CREATE TABLE #T(EmpId INT, EmpName VARCHAR(50),Salary MONEY)
INSERT INTO #T
SELECT 123, 'andy', 10000 UNION ALL
SELECT 111, 'Maddy', 12000 UNION ALL
SELECT 121, 'Raman', 25000 UNION ALL
SELECT 124, 'Hemanth', 40000 UNION ALL
SELECT 133, 'krishna', 50000 UNION ALL
SELECT 122, 'andy', 20000 UNION ALL
SELECT 134, 'Raman', 60000 UNION ALL
SELECT 143, 'Maddy', 30000

SELECT SUM(Salary),EmpName FROM #T GROUP BY EmpName

DROP TABLE #T



If everything seems to be going well, you have obviously overlooked something.

Ron

Please help us, help you -before posting a question please read

Before posting a performance problem please read
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search