IIF results in a Select - SQL statement 
Author Message
 IIF results in a Select - SQL statement

I am sorry I am getting old and don't remember how to do this, but we
all have this happen
sooner of later.

I am trying to get some division totals of the number of checks and the
number of invoices.

So I should get something like this

div1    34    36
div2    49    50
div3    80    88

My SQL command is

Select div, iif(chkamt >0,1,0) as noofchecks,iif(invamt > 0, 1,0) as
noofinvoices ;
from mytable ;
where void <> "V" ;
group by div

I already know this is not correct, but I remember the correct iif()
command technique.

Thanks for your help



Mon, 03 Nov 2003 23:46:58 GMT  
 IIF results in a Select - SQL statement
try: see CAPITALS below (SUM(iif....))
-

| I am sorry I am getting old and don't remember how to do this, but we
| all have this happen
| sooner of later.
|
| I am trying to get some division totals of the number of checks and the
| number of invoices.
|
| So I should get something like this
|
| div1    34    36
| div2    49    50
| div3    80    88
|
| My SQL command is
|
| Select div, SUM(iif(chkamt >0,1,0)) as noofchecks,SUM(iif(invamt > 0,
1,0)) as
| noofinvoices ;
| from mytable ;
| where void <> "V" ;
| group by div
|
| I already know this is not correct, but I remember the correct iif()
| command technique.
|
| Thanks for your help
|


Mon, 03 Nov 2003 23:56:20 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. adding memo field to result of Select statement

2. Different results with SELECT SQL and DELETE SQL.

3. SELECT-SQL mixed with IIF()

4. IIF() in SQL SELECTS

5. SQL Select using Iif()

6. SQL STATEMENT DIFFERENCE RESULTS

7. Select - SQL without a result set

8. what settings can effect results of SELECT SQL

9. SELECT - SQL result set dependant on whether table is indexed

10. SELECT SQL return wrong result

11. FP 2.5 erratic Select SQL results when using date fields

12. Select - SQL gives inconsistent results

 

 
Powered by phpBB® Forum Software