Louis Waweru
Louis Waweru

Reputation: 3672

Why does this subquery work in SQL Server but not SQLite?

This query gives the desired results on SQL Server but not in SQLite.

Desired result: return all letters that are not used in vocabulary words.

SELECT letter 
FROM alphabet
WHERE NOT EXISTS (
  SELECT word 
  FROM vocabulary
  WHERE word LIKE '%'+ letter + '%')

On SQL Server all the unused letters are returned, but on SQLite every letter (row in alphabet) is returned.

Do you know how I can get the desired result in SQLite?

Upvotes: 2

Views: 184

Answers (1)

Marc B
Marc B

Reputation: 360572

SQLite uses || to concatenate. What you're doing is addition.

Upvotes: 4

Related Questions