Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
IIF(,,) in an SQL Server SQL Statement
Message
De
18/04/2000 13:18:48
 
 
À
18/04/2000 11:37:37
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
00360347
Message ID:
00360938
Vues:
14
>This is what I get from the VFP Statement:
>
>SELECT Timehd.empid, Timehd.date,;
>  IIF(Timeitms.timeout>17.AND.Timeitms.timein>17,Timeitms.timeout-Timeitms.timein,Timeitms.timeout-17);
> FROM  prewel!timehd INNER JOIN prewel!timeitms ;
>   ON  Timehd.timecrdno = Timeitms.timecrdno;
> WHERE Timehd.date = CTOD(?NEXTCHKDATE1)-6;
>   AND Timeitms.jobno <> "LUNCH";
> GROUP BY Timehd.empid, Timehd.date;
> HAVING Timeitms.timeout>17;
> ORDER BY Timehd.empid
>
>
>So far this is the closest I have gotten with SQL Server:
>
>DECLARE @dNextChkDate DATETIME
>SET @dNextChkDate = CONVERT(DATETIME, '04/21/2000',101)-(14*1)
>
>SELECT Timehd.empid, Timehd.date, Timeitms.timeout, Timeitms.Timein,
>CASE
>WHEN Timeitms.timeout>17 AND Timeitms.timein>17 THEN Timeitms.timeout-Timeitms.timein
>ELSE Timeitms.timeout-17
>END AS Newcolumn
>FROM timehd INNER JOIN timeitms
>ON Timehd.timecrdno = Timeitms.timecrdno
>WHERE Timehd.date = @dNextChkDate-6
>AND Timeitms.jobno <> 'LUNCH'
>
>As you can see the correct values are in the result set. In VFP I just used the having clause to extinguish the unwanted values, but that doesn't seem to work with SQL Server. Do you have anymore suggestions?



I can't find the HAVING clause in the SELECT from SQL Server... Could that be it?
Sylvain Demers
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform