Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
IIF(,,) in an SQL Server SQL Statement
Message
From
18/04/2000 13:18:48
 
 
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
00360347
Message ID:
00360938
Views:
15
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform