SELECT max_student_allowed, max_student_allowed/2 AS Half_of_Max_Student, *, Total_Certified, Total_Placed,
Total_Trained FROM VW_getInvoiceBatchDetails WHERE Training_Partner_id = 'ESDM-HR-TP-000379' and batch_code = 'batch-hr-20452-db'
AND Total_Placed>=(CASE WHEN max_student_allowed % 2 = 0
THEN ((max_student_allowed/2))
ELSE ((max_student_allowed/2)+1)
END )
--------------------------------
Also we can use mod function for finding even and odd values
for even
SELECT *
FROM table_name
WHERE mod(column_name,2) = 0;
------------------------------
for odd
SELECT *
FROM table_name
WHERE mod(column_name,2) <> 0;
No comments:
Post a Comment