Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Horizontal Count
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00557820
Message ID:
00557823
Vues:
21
SELECT id FROM mytable ;
  WHERE (flag_1 And flag_2) OR (flag_1 AND flag_3) OR (flag_2 AND flag_3)

* or

SELECT id FROM mytable ;
  WHERE ( IIF(flag_1,1,0) + IIF(flag_2,1,0) + IIF(flag_3,1,0)) > 1
>Having a brain cramp.
>
>I have a table consisting of:
>
>person_id - char(10)
>flag_1 - logical
>flag_2 - logical
>flag_3 - logical
>
>
>I want to do a SQL statment which returns the person_id for any person who has more than 1 of any of the flag fields set to TRUE.
>
>
>select person_id from mytable where flag_1 OR flag_2 OR flag_3 ...but more than one of them....!
>
>
>
>any ideas? Thanks - Larry
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform