Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Flag for a value in a list
Message
De
14/01/2000 10:57:05
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
14/01/2000 09:59:31
Michael Dougherty
Progressive Business Publications
Malvern, Pennsylvanie, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00318140
Message ID:
00318158
Vues:
36
>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.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform