20 Apr
Many time we have a series of number in rows and we want to match only first 4 or 5 numbers in that row then we can use mysql inbuilt function. For example I have a doctor table which have following fields
ID | Name | Address | Zip_code |
1 | Rajeev | 72 east | 85632147569 |
2 | Vinod | 63 north | 85963214589 |
Now if we want to search doctors which have Zip_code 85632 then i can run query as below
SELECT * FROM doctor WHERE CONCAT( SUBSTRING(`Zip_code`, 1, 5), '%') =85632;
It will return first record.
I am a software engineer who specializes in Internet applications. I have worked with a wide variety of technologies and programming languages to open source LAMP environments. I have more than 6 years of object-oriented programming experience and am highly proficient in ActionScript, PHP, MYSQL, JavaScript, Jquery and a multitude of other technologies used in modern web applications.
Follow me
Latest posts by Rajeev Achra (see all)
- Jquery webcam plugin - June 19, 2016
- How To Add and Delete Users on a CentOSServer - June 5, 2016
- How To Set Up vsftpd on CentOS 6 - June 5, 2016