Reputation: 6788
I generate a dynamic pdf in which one section relies on a system 'indicator' value for what it actually prints.
The system queries a member table which each member has a Type of 0,1, or 2 (thousands of rows).
At the end of the full query, I need the script to set a variable which is indicative of the whole of results returned by that type field.
For example:
if in ANY of the type results returned there are values of 0, 1 AND 2, then set $result = 100;
If in ANY of the type results returned, there are only values of 0 and 1, then set $result = 200;
if in any of the type results returned, there are only values of 0, set $result = 300;
"" there are only values of 1, set $result = 400;
"" there are only values of 2, set $result = 500;
any good way to accomplish this?
Upvotes: 0
Views: 109
Reputation: 51640
You could just do a query like:
SELECT DISTINCT Type FROM Members WHERE ....
Which will return only 1 to 3 rows.
Then it's just a matter of a few if
s.
PS: you are missing the case where you have 0 and 2.
Upvotes: 3