У меня есть две таблицы в базе данных, и я хочу использовать результат ТИО таблицы и сравнить его с 2-й таблице, как:Сравните результаты двух таблиц с использованием Еогеасп
// we connect to example.com and port 3307
mysql_connect("localhost", "root", "pass123") or die(mysql_error());
mysql_select_db("PhGateway") or die(mysql_error());
$result = mysql_query("select mtMsgId from SMS where SMS.`result` = '0' ");
while($row = mysql_fetch_array($result))
{
$mtMsgid=$row['mtMsgId'];
}
Я хочу сравнить, а затем дисплей результат $mtMsgid
с другой таблицей другое имя таблицы DN и имеет два поля mtMsgId
и msgStatus
как:
select * from DN where mtMsgId = 'the whole above result'
1. Сделайте $ mtMsgid массив. 2. Используйте 'IN()': ''select * from DN, где mtMsgId IN ('. Implode (',', $ mtMsgid). ')'' 3. Или используйте 'JOIN' –