MYSQL: Can you pull results that match like 3 out of 4 expressions?

前端 未结 5 1198
眼角桃花
眼角桃花 2021-02-08 11:50

Say I have a query like this:

SELECT * FROM my_table WHERE name = \"john doe\" AND phone = \"8183321234\" AND email = \"johndoe@yahoo.com\" AND address = \"330 s         


        
5条回答
  •  庸人自扰
    2021-02-08 12:24

    Holy overcomplexity, Batman.

    SELECT * 
    FROM my_table 
    WHERE (
        (name = "john doe") +
        (phone = "8183321234") +
        (email = "johndoe@yahoo.com") +
        (address = "330 some lane")
    ) >= 3;
    

提交回复
热议问题