Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
IIF in Select
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Miscellaneous
Thread ID:
00832341
Message ID:
00832346
Views:
18
This message has been marked as the solution to the initial question of the thread.
You can use CASE function
SUM( CASE WHEN ShiftStart < '09/25/2003 1:30:00 PM' 
         AND ShiftEnd > '09/25/2003 1:59:59 PM' THEN 1 ELSE 0 END )/2 as one30_pm
>In VFP I can do this:
>
>SELECT LocationID, SUM(IIF(ShiftStart < CTOT('09/25/2003 1:30:00 PM') 
>         AND ShiftEnd > CTOT('09/25/2003 1:59:59 PM'),1,0))/2 as one30_pm ;
>	FROM Emp JOIN Shift ;
>	ON emp.empid = shift.empid ;
>	GROUP BY LocationID
>
>
>How can I do this in SQL Server?
>
>TIA
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform