Reputation: 197
Please refer below details
Current output:
EmpID EmployeeDailyFee EmployeeMonthlyFee CompanyDailyFee CompanyMonthlyFee 12 NULL 150 NULL NULL 12 120 NULL NULL NULL
Expected output:
EmpID EmployeeDailyFee EmployeeMonthlyFee CompanyDailyFee CompanyMonthlyFee 12 120 150 NULL NULL
Please let me know your suggestions
Upvotes: 0
Views: 60
Reputation: 18411
If you only get one non-null value in each column for each employee, you could try the following:
SELECT EmpID ,
MAX(EmployeeDailyFee) AS EmployeeDailyFee,
MAX(EmployeeMonthlyFee) AS EmployeeMonthlyFee,
MAX(CompanyDailyFee) AS CompanyDailyFee,
MAX(CompanyMonthlyFee) AS CompanyMonthlyFee
FROM Employees
GROUP BY EmpID
Upvotes: 2