I would use the case statement in this case, it is a very flexible method and can be very useful.
select id, (CASE WHEN trial_type_1 <> 'none' OR trial_type_2 <> 'none' OR trial_type_3 <> 'none' THEN 'True' ELSE 'False' END) as trial FROM q3773072
However, you could equally well do this as a simple logical operation, which is perhaps closer to what you want, as follows:
SELECT id, (trial_type_1 <> 'none' OR trial_type_2 <> 'none' OR trial_type_3 <> 'none' ) as Trial from q3773072
The correct way to do this, of course, is to store several test_tests in another table - when starting the number of fields, this is the key to the need to change the database schema . You should also set up another table that defines the types of samples and their definition - that is, regardless of whether it is a real trial version.
I would probably take the latter approach, as it is very likely that in the future one more type of sample will be added to you and it will hurt if you do not do it right.
source share