Php+mysql How to query the database for eligible columns.

Source: Internet
Author: User
The content format of my a table is like this.

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 the data listed as long as the last three digits of 008 are met. Neither in the middle nor in front. Must be the last three bits.

How to write with Php+mysql statement?
I can't write this right. Error.. I don't know how to get it. Ask me.
SELECT * from A WHERE cc like ' __008 '


Reply to discussion (solution)

How about this? 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.