sql server - SQL Where clause does not filter out "Zero" values -
Two tables are called recovery and installments
recovery ([pk] rid
When a loan is given to an employee, then that information will be sent to < Code> Recovery is accumulated in the table, then this loan is received in the form of installment from the monthly salary. (Installment of the amount of the installment (amount [zodiac / duration]]
). Once recovering, details about the installment of the installment should be deposited in the installments
table. Since a loan can be recovered in many installments, it is possible to recover the installment Relationship ship is 1: m.
Now we say that I just want to know all the recovery details which should be deducted from the salary. It is written here i have taken the sum of all the money paid and here Rate deduct it from the amount of the loan if the remaining amount is calculated installment is greater than 0. Expected Result Emp_DI | Installment (Recovery Recovery.Read, Recovery.AMP_ID, Recovery.Mount, Recovery Decrease, Install the installment on recovery as installments in installments such as SM (Recovery Recovery_transfer). Reid = installment.Recovery_ID where recovery.type = recovery by 'debt' group.Duration, recovery amount, recovery.mp3_id, recovery. come ID) Select emp_id, SUM (sum / duration) as summary from INS (as the case when the installment = tap then (amount-installment) (amount) END)> 0) group by emp_id
< / Pre>
This query correctly puts out the desired with an exception. To wit. It seems that where there is an issue, where the segment is in
WHERE ((Case when installment! = Tap then (zodiac-fund) ELSE (amount) END) <) < / Code>
This filter does not filter out as expected, with zero balance records I could not figure out the reason for it. So can you help me? Your support is really appreciated!
You are not zero
:
WHERE (The case when the installment is not faucet (amount-installment) ELSE (amount) END)>
Approximate NULL
, where = NULL
and
returns NULL
. And, NULL
is considered as incorrect and use IS NULL
and is not
.
Comments
Post a Comment