Hi
In below statement i want to get Top 1 record
CASE
WHEN (
SELECT COUNT(*)
FROM SessionDeliveryParticipant AS sub
WHERE sub.[SessionDeliveryCalendarID] = [SessionDeliveryCalendarID]
AND sub.PresentInSession = 0
) = COUNT(*) THEN 1
ELSE 0 End
Thanks
Tuhin PaulPosted Jun 23, 2023, 5:28 PM
I used the EXISTS keyword to check for the existence of records in the subquery result. The subquery groups the records by SessionDeliveryCalendarID and calculates the count of records where PresentInSession is 0. Then, it compares this count with the total count for each SessionDeliveryCalendarID. If they match, it means all the participants for that calendar session have PresentInSession set to 0.
Amit MohantyPosted Jun 23, 2023, 11:25 AM
Try this
Ramco RamcoPosted Jun 23, 2023, 11:17 AM
Hi Amit
I have written below statement but on Case it is giving message - An expression of non boolean type specified in a context where condition is expected.
Thanks
Amit MohantyPosted Jun 23, 2023, 11:10 AM