tjb
tjb

Reputation: 11728

SQLite Query: match any integer

I have a query like this:

SELECT num1,num2,num3,num4 from num_cols WHERE num1=1 AND num2=2 AND num3=3 AND num4=4;

I would like to reuse this query in contexts in which I may not wish to match every number exactly, so if I could do something like this:

SELECT num1,num2,num3,num4 from num_cols WHERE num1=1 AND num2=2 AND num3=* AND num4=4;

where * would match any num3. Is there a character or function like * in sqlite3 which will match any value?

Is there one for integers? Is there one for strings?

Upvotes: 1

Views: 645

Answers (1)

n8wrl
n8wrl

Reputation: 19765

Can you just leave num3 off the select list? Wouldn't that 'match' any integer? Or, if num3 could be null say

num3 is not null

Upvotes: 1

Related Questions