Click here to Skip to main content
15,900,378 members
Home / Discussions / Database
   

Database

 
QuestionCan't Get Required Output while executing Store Procedure. Any help would be appreciated ? Pin
K K Shah13-Feb-19 23:18
K K Shah13-Feb-19 23:18 
When i execute the procedure what i get the output is like -

ALTER PROC [dbo].[PROC_EMPLOYEE_PAY_SLIP]
@EmplopyeeCode varchar(100),
@MonthName varchar(50),
@Year Float
As
Begin
SELECT ISNULL(HR_EmployeeMaster.em_EmplopyeeCode,'') As EmplopyeeCode,
ISNULL(CASE WHEN fa_ComponentMaster.Cm_ADTag = 'A' THEN fa_ComponentMaster.Cm_Name ELSE '' END,'') As Additions,
ISNULL(CASE WHEN fa_ComponentMaster.Cm_ADTag = 'D' THEN fa_ComponentMaster.Cm_Name ELSE '' END,'') As Deductions,
ISNULL(CASE WHEN fa_ComponentMaster.Cm_ADTag = 'A' THEN Fa_MonthSalary.Ms_Amount ELSE 0 END,0) As AdditionsAmount,
ISNULL(CASE WHEN fa_ComponentMaster.Cm_ADTag = 'D' THEN Fa_MonthSalary.Ms_Amount ELSE 0 END,0) As DeductionsAmount
FROM HR_EmployeeMaster
LEFT JOIN Fa_MonthSalary ON Fa_MonthSalary.ms_EmpCode = @EmplopyeeCode
LEFT JOIN Fa_MonthDetails ON Fa_MonthDetails.mo_id = Fa_MonthSalary.Ms_MonCode
LEFT JOIN fa_ComponentMaster ON fa_ComponentMaster.cm_code = Fa_MonthSalary.Ms_CompCode
WHERE HR_EmployeeMaster.em_EmplopyeeCode = @EmplopyeeCode AND
(SELECT CONVERT(CHAR(3), Fa_MonthDetails.mo_name)) = @MonthName AND
Fa_MonthDetails.mon_year = @Year
End

Current Output -

EmployeeCode  Additions      Deductions   AdditionsAmount  DeductionsAmount
M1010         ALLOWANCE                     960.00               0
M1010         BASIC SALARY                  1390.00              0
M1010         OT1                           171.35               0
M1010                        OTHERS-DED     0.00                 1800.00


Required Output -

EmployeeCode  Additions      Deductions   AdditionsAmount  DeductionsAmount
M1010         ALLOWANCE      OTHERS-DED     960.00               1800.00
M1010         BASIC SALARY                  1390.00              0
M1010         OT1                           171.35               0


Any help would be appreciated Frown | :(
AnswerRe: Can't Get Required Output while executing Store Procedure. Any help would be appreciated ? Pin
Richard MacCutchan14-Feb-19 1:35
mveRichard MacCutchan14-Feb-19 1:35 
QuestionMongoDB Transactions Pin
Kevin Marois13-Feb-19 14:25
professionalKevin Marois13-Feb-19 14:25 
AnswerRe: MongoDB Transactions Pin
k505414-Feb-19 6:09
mvek505414-Feb-19 6:09 
QuestionC# MongoDB Question Pin
Kevin Marois10-Feb-19 7:58
professionalKevin Marois10-Feb-19 7:58 
AnswerRe: C# MongoDB Question Pin
k505412-Feb-19 6:07
mvek505412-Feb-19 6:07 
AnswerRe: C# MongoDB Question Pin
jschell23-Feb-19 11:11
jschell23-Feb-19 11:11 
QuestionSQLite how to delete rows in a table (C++) Pin
steve_94966138-Feb-19 5:08
professionalsteve_94966138-Feb-19 5:08 
AnswerRe: SQLite how to delete rows in a table (C++) Pin
k50548-Feb-19 7:21
mvek50548-Feb-19 7:21 
GeneralRe: SQLite how to delete rows in a table (C++) Pin
steve_949661310-Feb-19 21:30
professionalsteve_949661310-Feb-19 21:30 
GeneralRe: SQLite how to delete rows in a table (C++) Pin
k505413-Feb-19 7:14
mvek505413-Feb-19 7:14 
GeneralRe: SQLite how to delete rows in a table (C++) Pin
steve_949661320-Feb-19 20:55
professionalsteve_949661320-Feb-19 20:55 
GeneralRe: SQLite how to delete rows in a table (C++) Pin
k505421-Feb-19 7:15
mvek505421-Feb-19 7:15 
GeneralRe: SQLite how to delete rows in a table (C++) Pin
steve_949661325-Feb-19 4:25
professionalsteve_949661325-Feb-19 4:25 
AnswerRe: SQLite how to delete rows in a table (C++) Pin
Mycroft Holmes8-Feb-19 12:50
professionalMycroft Holmes8-Feb-19 12:50 
GeneralRe: SQLite how to delete rows in a table (C++) Pin
steve_949661310-Feb-19 21:56
professionalsteve_949661310-Feb-19 21:56 
GeneralRe: SQLite how to delete rows in a table (C++) Pin
Mycroft Holmes11-Feb-19 10:53
professionalMycroft Holmes11-Feb-19 10:53 
AnswerRe: SQLite how to delete rows in a table (C++) Pin
Richard MacCutchan8-Feb-19 22:44
mveRichard MacCutchan8-Feb-19 22:44 
GeneralRe: SQLite how to delete rows in a table (C++) Pin
steve_949661310-Feb-19 21:58
professionalsteve_949661310-Feb-19 21:58 
Questionfinding periods Pin
joost.versteegen8-Feb-19 4:22
joost.versteegen8-Feb-19 4:22 
AnswerRe: finding periods Pin
joost.versteegen9-Feb-19 10:40
joost.versteegen9-Feb-19 10:40 
Questionupdate temp table with results from sub query (actually it is a function) Pin
joost.versteegen7-Feb-19 3:32
joost.versteegen7-Feb-19 3:32 
AnswerRe: update temp table with results from sub query (actually it is a function) Pin
ZurdoDev7-Feb-19 4:36
professionalZurdoDev7-Feb-19 4:36 
GeneralRe: update temp table with results from sub query (actually it is a function) Pin
joost.versteegen7-Feb-19 4:45
joost.versteegen7-Feb-19 4:45 
AnswerRe: update temp table with results from sub query (actually it is a function) Pin
Richard Deeming7-Feb-19 8:34
mveRichard Deeming7-Feb-19 8:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.