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

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.

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.