I am trying to get the messages where the sendID is equal to one of two values. This is the statement that I have but it seems to spit out only the messages associated with the first sendID.
(SELECT * FROM messages WHERE sendID = ? AND ? ORDER BY timeStamp ASC', id1, id2)
Can anyone suggest a good method to do this?
Thanks
Description. The SQLite || operator allows you to concatenate 2 or more strings together.
The AND operator allows the existence of multiple conditions in a SQLite statement's WHERE clause. While using AND operator, complete condition will be assumed true when all the conditions are true. For example, [condition1] AND [condition2] will be true only when both condition1 and condition2 are true.
SQLite provides two wildcards for constructing patterns. They are percent sign % and underscore _ : The percent sign % wildcard matches any sequence of zero or more characters. The underscore _ wildcard matches any single character.
WHERE sendID = ? OR sendID = ?
or
WHERE sendID IN (?, ?)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With