Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / SQL Server / ADP / November 2005

Tip: Looking for answers? Try searching our database.

Need help with count function

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
WebRaster - 10 Nov 2005 10:47 GMT
I need to count how much "assenze" I have in this query, as cover is a text
field I try to use the IIF as you can see below. BUT It does work! Damn.

Query = "SELECT Sum(IIF(cover = 'NO', 1, 0)) as assenze, SUM(stato) as
daypresidio  FROM copertura  WHERE day between '11/12/2005' and '11/18/2005'
Group by day ORDER BY day ASC"

Please Help
Norman Yuan - 10 Nov 2005 14:13 GMT
Since you post in Access.adp.sqlserver NG, I assume your query is going to
run on Sql Server/MSDE.

There is no IIF... in T-SQL, you use CASE... instead:

SELECT
   SUM
   (
       CASE
           WHEN conver='NO' THEN 1
           ELSE 0
       END
   ) AS assenze,
   SUM(stato) AS daypresido
FROM
   ....

>I need to count how much "assenze" I have in this query, as cover is a text
>field I try to use the IIF as you can see below. BUT It does work! Damn.
[quoted text clipped - 4 lines]
>
> Please Help
WebRaster - 11 Nov 2005 16:46 GMT
Thank you very much.

> Since you post in Access.adp.sqlserver NG, I assume your query is going to
> run on Sql Server/MSDE.
[quoted text clipped - 22 lines]
>>
>> Please Help
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.