How SQL SELECT queries 2 values at a time

Source: Internet
Author: User
For example, in the database, a key hide=y and hide=n to achieve the same amount of data equal to Y and n how to write
The SQL statement is not very understanding I wrote this, although no error
SELECT * FROM blog WHERE type= ' $type ' $author and hide= ' y ' and hide= ' n ' $condition $limit
But it doesn't even show.
SELECT * FROM blog WHERE type= ' $type ' $author and hide= ' y ' $condition $limit
This can be done, but this can show that equals y does not achieve equal to N.


Reply to discussion (solution)

What are your $author $condition, respectively?

Similar, modify to see

SELECT * from ' blog '  WHERE ' type ' = ' $type '     and ' author ' = ' $author '     and ' hide ' in ("Y", "n") LIMIT

You can use it or not. Why use and AH ~ How can be equal to Y and equal to n

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.