开发者

Sqlite Query 'AND'

开发者 https://www.devze.com 2023-03-03 01:28 出处:网络
I am stuck at a place where i am able to proceed with a sqlite SELECT query. My query is like this. I dont know if it tis correct or wrong. Please help me.

I am stuck at a place where i am able to proceed with a sqlite SELECT query. My query is like this. I dont know if it tis correct or wrong. Please help me.

NSString *querySQL = [NSString stringWithFormat: @"SELECT * FROM CLAIMS WHERE DATE = \"%@\" AND TIME = \"%@\"",splitdate,splittime];

Any help is开发者_运维问答 appreciated. Thanks


SQL uses ' for strings, so at the very least your query should look like:

SELECT * FROM CLAIMS WHERE DATE = '%@' AND TIME = '%@'

A further step would be to make those things parameters:

SELECT * FROM CLAIMS WHERE DATE = @date AND TIME = @time

And a further improvement is to use the SQL type datetime for the field so you'll only need one instead of 2:

SELECT * FROM CLAIMS WHERE DATE = @date
0

精彩评论

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

关注公众号