Logo Home    Page list

SQLite Question - SELECT WHERE IN #sql

Here's a pretty dumb question. Why will the following extremely simple query not return the desired results? I'm trying to see the sentence templates just for the birth, death, marriage, and burial facts.
SELECT FT.FactTypeID, FT.Name, FT.Sentence
FROM FactTypeTable AS FT
WHERE FT.Name IN ('Birth','Death','Marriage','Burial');
To get the desired results, I instead do something like the following.
SELECT FT.FactTypeID, FT.Name, FT.Sentence
FROM FactTypeTable AS FT
WHERE FT.Name IN ('Birth','Death','Marriage','Burial')
AND FT.Name NOT LIKE '%Bann'
AND FT.Name NOT LIKE '%Contract'
AND FT.Name NOT LIKE '%License'
AND FT.Name NOT LIKE '%Settlement';
In effect, the IN operator is acting like it's using LIKE rather than =. So it's picking fact names I don't want such as Marriage Bann, etc.

Jerry

Discussions

ve3meo

Not seeing your problem

ve3meo 05 June 2015 19:29:42

I ran your first query using SQLiteSpy and it returned the desired result.

Tom

www.000webhost.com