Excluding Rows Based on Column Contents

I'm trying to write a query which will exclude rows based on their common value in a particular column if a value in another column exists. Essentially:

SELECT Phone, Name, Age FROM Customer WHERE etc etc etc

What I would like to do is: If, for example, one customer's information would be: 111-222-3333, Rick, 45, and for whatever reason 45 is the particular value for which if it exists, I'd like to exclude all subsequent rows which match that corresponding telephone number, how would I do this?

Thanks!

Answers


Sounds like a WHERE NOT EXISTS may work here,

SELECT Phone, Name, Age
FROM Customer C
WHERE NOT EXISTS (
    SELECT * FROM Customer M
    WHERE M.Age = 45 AND M.Phone = C.Phone
)

Need Your Help

Accessing parent element in javascript without creating handler

javascript jquery

Is it posible to access the variable defined in parent function without creating the handler for it ?

Css gray scale and setting an image on it using :after

html css

There is an image with id img1 and I need to put another image with id img2 on it. When the mouse is hover on the #img1 I need it to be black-white but the #img2 shouldn't be.