开发者

SQLite Query: match any integer

开发者 https://www.devze.com 2023-02-24 23:14 出处:网络
I have a query like this: SELECT num1,num2,num3,num4 from num_cols WHERE num1=1 A开发者_StackOverflowND num2=2 AND num3=3 AND num4=4;

I have a query like this:

SELECT num1,num2,num3,num4 from num_cols WHERE num1=1 A开发者_StackOverflowND 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?


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
0

精彩评论

暂无评论...
验证码 换一张
取 消