Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Flag for a value in a list
Message
From
15/01/2000 01:35:59
 
 
To
14/01/2000 10:57:05
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00318140
Message ID:
00318498
Views:
20
>>10 entries of Rep,month,pub
>>
>>Sele Rep,iif(pub="SA",.T.,.F.) as SA_flag Group by Rep
>>
>>I want to flag those reps who worked on the SA pub, while also selecting the list of reps. Will this statement work? (in testing, it appears to work) My concern is that if another pub value occurs in the selection after the "SA" value, that the SA_flag value will return to the .F. state.
>>
>>The alternative is to do 2 separate selections for each group, but i don't want to have to do that...
>>
>>Any suggestions?
>
>
Michael,
>This could work if last pub entry for a particular rep is "SA" or there is only one pub per rep.
>
>
select distinct rep, .t. as SA_flag from myTable ;
> where pub = "SA" ;
>union ;
>select distinct rep, .f. as SA_flag from myTable ;
> where rep not in (select distinct rep from myTable where pub="SA") ;
>order by 1
Seems to be a way.

What about:

SELECT REP, SUM(IIF(pub="SA",1,0))>0 AS SA_FLAG FROM MyTable INTO CURSOR SA GROUP BY REP


>Cetin
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
Next
Reply
Map
View

Click here to load this message in the networking platform