开发者

SQLite Params and wildcards

开发者 https://www.devze.com 2023-04-12 07:56 出处:网络
I\'m trying to query like this... SELECT * FROM Urls WHERE Urls.url LIKE \'%\' + \'sports\' + \'%\' The above returns no records, whereas the following does return records.

I'm trying to query like this...

SELECT * FROM Urls
WHERE Urls.url LIKE '%' + 'sports' + '%'

The above returns no records, whereas the following does return records.

SELECT * FROM Urls
WHERE Urls.url LIKE '%sports%'

The reason why I want to use the first example is because I'd like to replace 'sports' with a param but when I so so I get no records returned.

开发者_如何学CANSWER:

I just Googled 'sqlite +concatenation' :)

SELECT * FROM Urls
WHERE Urls.url LIKE '%' || 'sports' || '%'
0

精彩评论

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

关注公众号