Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Counter
Message
From
29/08/2000 22:17:40
 
 
To
29/08/2000 21:17:08
Gavin Reid
L & M Marketing Pty Ltd
Frenchs Forest, Australia
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
00410576
Message ID:
00410590
Views:
14
>Hi Michael,
>
> I think you're after:
>
>SELECT SUM(IIF(x > 3,1,0)) AS counter FROM table1
>
>Gavin...

Or:

SELECT Count(*) AS COUNTER FROM Table1 WHERE x > 3

this is optimizable, or at least more likely to be optimizable if there's a tag based on x - the IIF() would be evaluated record by record in all probability.

>
>>I'm trying to increment a counter in a SQL statement based on a condition. I've seen the code before somewhere, but I can't find it. It's something like this:
>>
>>select max(iif(x>3,1,0),1) as counter ;
>> from table1
>>
>>
>>
>>This code isn't right, far from it, but there was someway to increment the "counter" that I can't remember. Does anyone have any idea what I'm talking about?
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform