Josef H.
Josef H.

Reputation: 19

What is the SQLite query to extract data from one column if a BOOL column is set to 'true'?

The following query works for me (in SQLite) for a simple search in the database.

SELECT  *
FROM    slovník
WHERE   Note like '%); "%'

What if I want to do the same search but want to filter the results further like this:

[please see the screenshot][1]

Upvotes: 0

Views: 58

Answers (2)

forpas
forpas

Reputation: 164234

The column Phrase in your table stores integer values 0 or 1 which are the values that SQLite considers as Boolean.
In your case any of the below statements will work:

WHERE Note like '%); "%' AND Phrase

or

WHERE Note like '%); "%' AND Phrase = true

or

WHERE Note like '%); "%' AND Phrase = 1

Upvotes: 0

Simulant
Simulant

Reputation: 20150

2.1. Boolean Datatype

Boolean values are stored as integers 0 (false) and 1 (true).

So your query would look like the following, to select rows where the phrase is true:

SELECT  *
FROM    slovník
WHERE   Phrase = 1
  AND   Note like '%); "%';

Upvotes: 1

Related Questions