SQLite SELECT等于两个值之一 [英] SQLite SELECT equal to one of two values

查看:187
本文介绍了SQLite SELECT等于两个值之一的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试获取sendID等于两个值之一的消息. 这是我的陈述,但似乎只吐出了与第一个sendID相关的消息.

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?

谢谢

推荐答案

 WHERE sendID = ? OR sendID = ?

 WHERE sendID IN (?, ?)

这篇关于SQLite SELECT等于两个值之一的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆