MYSQL选择表行,其中列包含我的代码中多个记录中的相同数据

时间:2016-03-20 10:24:30

标签: mysql

我这里有一个mysql代码 -

$querymypm = "SELECT * FROM pm WHERE recieverun='$uname' AND senderun='$c' ORDER BY pmid DESC";

但我想要这样 -

$querymypm = "SELECT * FROM pm WHERE recieverun='///(Taking more than one value)///' AND senderun='///(Taking more than one value)///' ORDER BY pmid DESC";

1 个答案:

答案 0 :(得分:0)

使用IN运算符。

$querymypm = "SELECT * FROM pm WHERE recieverun IN ('$uname1', '$uname2', '$uname3') AND senderun IN ('$c1', '$c2', '$c3') ORDER BY pmid DESC";