How to query qualified columns in the database using PHP + MYSQL.

Source: Internet
Author: User
How to query qualified columns in the database using PHP + MYSQL. The content format of my table A is as follows.

Field aa field bb field cc
1,000,001,008 100
2,000,002,003,008 30
3,000,012,008 20
4,000,008,222 55
5,000,008,138 33

I need to query and list the data that matches the last three digits of 008. Neither the middle nor the front. It must be the last three digits.

How to write a PHP + MYSQL statement?
This is not the case for me. Error .. I don't know how to fix it. Ask me for advice.
SELECT * from a where cc LIKE '_ 008'


Reply to discussion (solution)

So what? SELECT * from a where cc LIKE '%, 008 ';

Try again SELECT * from a where substring (bb, 0,-3) = '008 ';

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.