Jump to content

LIKE query works for number but not for character


elabuwa

Recommended Posts

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'

:shrug:

Any idea? :wtf: :wtf:

 

FYI, the table has records where the account field has records begining from "a".

Field is VARCHAR

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.