Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
IIF in Select
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Divers
Thread ID:
00832341
Message ID:
00832346
Vues:
20
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--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform