Is it possible to select more statements in SQLite?

0

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

vb.net
sqlite
asked on Stack Overflow Feb 16, 2020 by dphuc23

1 Answer

1

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%'
answered on Stack Overflow Feb 16, 2020 by juergen d • edited Feb 16, 2020 by juergen d

User contributions licensed under CC BY-SA 3.0