Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
how can i mix both querys
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
select max(case when Parameter = '+' then Description end) as[Allowance] , max(case when Parameter = '-' then Description end)as[Deduction] from (select*,row_number() over (partition by Parameter order by Id) as RN from Cygnus_HR_Salary_Structure_Master_General)X group by RN select sal.EmployeeID,emp.Name as [Name],gm.CodeDesc as[Designation], (CASE WHEN sm.Parameter='+' THEN sm.Description END ) as[Allowance], (CASE WHEN sm.Parameter='+' THEN sm.Amount END ) as[Allowance Amount], (CASE WHEN sm.Parameter='+' THEN sm.Percentage END ) as[Percentage], (CASE WHEN sm.Parameter='-' THEN sm.Description end) as[Deduction], (CASE WHEN sm.Parameter='-' THEN sm.Amount END ) as[Deduction Amount], (CASE WHEN sm.Parameter='-' THEN sm.Percentage END ) as[Percentage], (CASE WHEN sm.IsOther='1' AND sm.Parameter='+' THEN sm.Amount END) as[Others Allowance], (CASE WHEN sm.IsOther='1' AND sm.Parameter='-' THEN sm.Amount END) as[Others Deduction] FROM CYGNUS_HR_Employee_SalaryStructureSlab sal INNER JOIN Cygnus_HR_Employee_Master emp on sal.EmployeeID=emp.EmployeeID INNER JOIN Cygnus_HR_Salary_Structure_Master_General sm on sal.SalaryComponent=sm.SalaryComponent INNER JOIN Cygnus_HR_Master_General gm ON gm.CodeId=emp.Designation GROUP by sm.Parameter,sal.EmployeeID,emp.Name,gm.CodeDesc,sm.Description,sm.Amount,sm.Percentage,sm.IsOther
View schema
edit mode
|
history
|
discussion