SQLite Forum

Disparity in results using like and '='
Login
I get different results from a query depending on whether I use 'like' or '=', and now need to find out which records are different.

The column I'm accessing is 'text' and contains short strings. I am looking for "Jazz - Fusion". That is the string "Jazz" + the string " - " (space hyphen space) + the string "Fusion".

When I use a 'like' I get 1100 results, but when I use '=' I get 1098 results.

<code>
sqlite> select count(*) from cds where genre like "Jazz%";
1100
sqlite> select count(*) from cds where genre = "Jazz - Fusion";
1098
</code>

How can I find out which records have  some odd character/s?  I'm using Perl on a Mac to create a web page, with this command to pull out the first letter of each genre:
<code>
$sth=$dbh->prepare(qq{select substr(genre, 1, 1),genre FROM cds group by genre order by genre});
</code>
but what I get is: A  B  C  E  F  J  J  R  W. 

So it seems there are 2 'Jazz - Fusion' entries, and I can't determine where the difference is. I'm thinking one of the hyphens is a 'figure dash' or some such.
Anyone have an idea how I can find the culprit?