Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Horizontal Count
Message
From
18/09/2001 10:27:03
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00557820
Message ID:
00557829
Views:
9
This message has been marked as the solution to the initial question of the thread.
I think that Sergey's solution is correct, but difficult to extend to more than 3 flags. Try converting the flags to numeric.
... where iif(flag_1, 1, 0) + iif(flag_2, 1, 0) + iif(flag_3, 1, 0) >= 2
HTH, Hilmar.

>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
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform