ve madde ilk olarak başka bir tabloya dahil eğer mysql, sipariş tarafından kontrol

0 Cevap php

MySQL:

tablo1

+--------+-------+
| itemid | title |
+--------+-------+
|   1    | title |
+--------+-------+

table2

+----+--------+------------+
| id | itemid |    time    |
+----+--------+------------+
|  1 |    1   | 1295116368 |
+----+--------+------------+
|  1 |    2   | 1295548368 |
+----+--------+------------+
|  2 |    1   | 1294079568 |
+----+--------+------------+

PHP:

$a = mysql_query("SELECT `itemid` FROM `table2` WHERE `id` = '1' ORDER BY `time` DESC")
while($b = mysql_fetch_assoc($a))
{
    echo $b['itemid'].'<br />';
}

Output:

2
1

However, what I want to do in the query above is to also check whether itemid is also included in tablo1, because when it is I want it to show up first, despite the fact that it might be an older post.

Bu mantıklı umuyoruz.

Yani, çıkış olmalıdır:

1
2

because itemid = 1, is also included in tablo1.

0 Cevap