我有查询。
SELECT * FROM '.PRFX.'sell
WHERE draft = "0" '.$e_sql.'
AND ID NOT IN (SELECT id_ FROM '.PRFX.'skipped WHERE uid = "'.$u.'")
AND ID NOT IN (SELECT id_ FROM '.PRFX.'followed WHERE uid = "'.$u.'")
ORDER BY raised DESC '.$sql_limit;
我希望以最少的刷新次数添加3条记录;最好的第五位
它们必须是唯一的(所以如果你连接两个UNION ALL ......)
答案 0 :(得分:0)
首先,您需要使SQL更具可读性。像这样的东西
SELECT * FROM sell
WHERE draft = 0
AND ID NOT IN (SELECT id_ FROM skipped WHERE uid = '0')
AND ID NOT IN (SELECT id_ FROM followed WHERE uid = '0')
ORDER BY raised DESC LIMIT 15
那么,你想要什么?通过单个请求将数据添加到sell
表?这可以通过这样的请求来完成
INSERT INTO sell (key1, key2, keyN)
VALUES
('aaa', 'bbb', 'ccc'),
('ddd', 'eee', 'fff');
-- and so forth.