stored procedure to find value in 2 columns out of 3

Posted by user1510533 on Stack Overflow See other posts from Stack Overflow or by user1510533
Published on 2012-07-09T02:28:24Z Indexed on 2012/07/09 3:16 UTC
Read the original article Hit count: 287

Filed under:

I am putting in the samle date and i am supposed to do something similar what i am asking. I want to run a query that would pull values in any two columns out 3 if it has a 1 or if any one column has a 1 it will return just those results. However it should search all three columns and in any of the three columns where it found value as 1 it should return that result. Can anyone please help me with this. Thanks in advance.

 ID Patient Patient Name    prio  prio2   prio3
 -------------------------------------------------
 1  101563  Robert Riley        1     1       1
 2  101583  Cody Ayers          1     0       1
 3  101825  Jason Lawler        0     0       1
 4  101984  Dustin Lumis        1     0       0
 5  102365  Stacy smith         1     0       0
 6  102564  Frank Milon         1     0       0
 7  102692  Thomas Kroning      1     0       0
 8  102856  Andrew Philips      1     0       0
 9  102915  Alice Davies        0     0       1
 10 103785  Jon Durley          0     0       1
 11 103958  Clayton Folsom      1     1       1
 12 104696  Michelle Holsley    1     1       1
 13 104983  Teresa Jones        1     0       1
 14 105892  Betsy Prat          1     1       0
 15 106859  Casey Ayers         1     1       0

© Stack Overflow or respective owner

Related posts about sql