elabuwa Posted November 9, 2011 Share Posted November 9, 2011 Hi guys, When I run the below query it works when I use a number for the "account" like part, but if I run a letter like "a" or "A" it returns no results. Works SELECT company,contact,booking_id,date_created,camp_id FROM campaign_summary WHERE uid='1' AND account LIKE '5%' AND type='P' Does NOT work SELECT company,contact,booking_id,date_created,camp_id FROM campaign_summary WHERE uid='1' AND account LIKE 'a%' AND type='P' Any idea? :wtf: FYI, the table has records where the account field has records begining from "a". Field is VARCHAR Quote Link to comment https://forums.phpfreaks.com/topic/250770-like-query-works-for-number-but-not-for-character/ Share on other sites More sharing options...
PFMaBiSmAd Posted November 9, 2011 Share Posted November 9, 2011 Are you sure you don't have a white-space/non-printing character before the 'a' in the data? You would need to dump the database record that you think the query should match and examine it to make sure that all the data is actually what you think. The uid, account, or type might not actually be what the query is trying to find. Quote Link to comment https://forums.phpfreaks.com/topic/250770-like-query-works-for-number-but-not-for-character/#findComment-1286600 Share on other sites More sharing options...
fenway Posted November 9, 2011 Share Posted November 9, 2011 Are you sure you don't have a white-space/non-printing character before the 'a' in the data? Easy to check -- use LOCATE(). Quote Link to comment https://forums.phpfreaks.com/topic/250770-like-query-works-for-number-but-not-for-character/#findComment-1286678 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.