I have 2 rows in a table. Each row contains a primary key, and 5 additional columns, whose value may be 1, or 0.
So for example one of the columns is "TermsAccepted" and another is "CopyrightAcknowledged"
Row 1's "Terms Accepted" might be 0 or 1, and row 2's "Terms Accepted" might be 0 or 1 as well.
I'd like to know if at least one of the rows contains a 1 for each column. Do I have to use 5 subqueries to do this (I'd like to just have one row returned that tells me if any of the columns have 1's in them). It doesn't matter to me how many had 1, just so long as at least one column did.
Hopefully that made sense. How could I write a query to do this? i'm somewhat stuck. Thanks so much!
Note: I can just return both records, and then use Swift (the programming language i'm doing this in) to just parse each column in each row and look for a 0 or a 1, but I was hoping for something in SQL to make it more elegant if possible.
Aucun commentaire:
Enregistrer un commentaire