A php complicated judgment problem. thank you.

Source: Internet
Author: User
Ask everyone for a complicated PHP judgment question, thanks for the database's fields A, B, C, D, E, and F. assume that the F field content is 1, 2, 3, 4, 5, and 6 respectively. what we want to achieve now is when F when = 1, I output the content in F = 1 all A, B, C, D, and E. When F = 2, I output the content in F = 2 all A, B, C, and D. the content in E is as follows, thank you.

The database has fields A, B, C, D, E, and F.
Assume that the F field content is 1, 2, 3, 4, 5, and 6 respectively.
What we want to achieve now is
When F = 1
I output all the content in A, B, C, D, and E according to F = 1.
When F = 2
I output all the content in A, B, C, D, and E according to F = 2.
F = 6
How can I express it in code ?? Thank you.

------ Solution --------------------
You are all A, B, C, D, E. I guess you didn't make it clear. it would be nice if you followed what you said.

Select a, B, C, D, E FROM tbl_name WHERE F IN (1, 2, 3, 4, 5, 6 );

------ Solution --------------------
Are A, B, C, D, E, and F in the same table?
Otherwise, a foreign key is required.
If it is in the same table, 2 # positive solution.

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.