MySQL的。如何在其他表中按订单排序

时间:2014-12-11 13:33:57

标签: mysql

我有:

SELECT * FROM '.PRFX.'sell
WHERE draft = "0" AND id
IN ( SELECT id_ FROM '.PRFX.'skipped
     WHERE uid = "'.$u.'" )

我想从ID field (DESC)

'.PRFX.'skipped'订购

怎么做?

1 个答案:

答案 0 :(得分:0)

您可以使用左连接:

SELECT   DISTINCT * 
FROM     '.PRFX.'sell sell
JOIN     '.PRFX.'skipped skip ON skip.id_ = sell.id
WHERE    draft = "0" AND skip.uid = "'.$u.'"
ORDER BY skip.id DESC