dphuc23
dphuc23

Reputation: 63

Is it possible to select more statements in SQLite?

I have the following code :

SELECT Description FROM KeysDB WHERE Count='0 (Blocked)' OR ErrorCode='0xC004C060' AND Description LIKE '%Win%'

It works normally until I change it.

SELECT Description FROM KeysDB WHERE Count='0 (Blocked)' OR ErrorCode='0xC004C003' OR ErrorCode='0xC004C060' AND Description LIKE '%Win%'

I want to select all Windows product key with Count = 0 (Blocked) or ErrorCode = 0xC004C060 or ErrorCode = 0xC004C003

Upvotes: 0

Views: 38

Answers (1)

juergen d
juergen d

Reputation: 204766

and / or have different operator precedence. That means their binding strength is differently.

You can use parentheses to make it how you like. Not sure if this is how you intended it but you get the picture:

SELECT Description 
FROM KeysDB 
WHERE 
(
   Count='0 (Blocked)' OR ErrorCode='0xC004C003' OR ErrorCode='0xC004C060'
) 
AND Description LIKE '%Win%'

Upvotes: 1

Related Questions