0

I'm trying to identify if a row has the value '1' anywhere in it (AKA any column). Is there an easy way to do this without searching every column with fetchrow_array? I've included a small table I've been working with as an example.

mysql> select * from Case_Tracking;
+--------------------+---------+---------+----------+---------+----------+---------------+
| accession_number   | cyp2d6  | cyp2c19 | factorII | factorV | apoe     | vkorc1_cyp2c9 |
+--------------------+---------+---------+----------+---------+----------+---------------+
| AIB14-1116-0000453 | Luminex | Luminex | Hologic  |       1 | ABI 7500 | Genmark       |
| AIB14-1123-0000074 | NULL    | Luminex | Hologic  | Hologic | ABI 7500 | Genmark       |
+--------------------+---------+---------+----------+---------+----------+---------------+
0

1 Answer 1

2

It would be better to search every column using SQL (WHERE accession_number = '1' OR cyp2d6 = '1' OR ...) since you'd only need to fetch matching results.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, I thought maybe I was missing some sort of magical function, but it seems I have to look at each column.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.