我有2张桌子。第一个包含组列表。第二个包含发布帖子的时间。 您需要获取一个组列表,并发布给他们,但帖子应按时间排序。 当我进行分组时,禁食时间不一样。
table time_post
+----+---------------+--------+-----------+
| id | id_public | img_id | time_post |
+----+---------------+--------+-----------+
| 1 | 1 | 2 | 5 |
| 2 | 2 | 1 | 1 |
| 7 | 1 | 1 | 55 |
| 8 | 1 | 3 | 2 |
| 10 | 3 | 3 | 4 |
| 11 | 3 | 3 | 2 |
+----+---------------+--------+-----------+
table public
+----+-----------+-------------+--------------+-----------+
| id | id_public | time_update | access_token | text_send |
+----+-----------+-------------+--------------+-----------+
| 1 | 9876 | 0 | 1234 | |
| 2 | 12345 | 0 | 12345 | |
| 3 | 22222 | 0 | | |
+----+-----------+-------------+--------------+-----------+
To get this result
+-----------+-------------+--------------+-----------+
| id_public | time_post | access_token | text_send |
+-----------+-------------+--------------+-----------+
| 9876 | 2 | 1234 | |
| 12345 | 1 | 12345 | |
| 22222 | 2 | | |
+-----------+-------------+--------------+-----------+
time_post应按最小值
排序答案 0 :(得分:0)
window
<强>输出强>
// worker.js
function foo() {
console.log("hello worker");
}
self['foo']()
<强>演示强>
答案 1 :(得分:0)
SELECT p.id_public,min(t.time_post),p.access_token,p.text_send FROM public as p,time_post as t 在哪里p.id = t.id_public p.id_public小组,p.access_token,p.text_send
试试这个,我希望它有效。
对于演示链接, https://www.db-fiddle.com/f/46M8v9opAeVc834tZ15Vur/0#&togetherjs=nRGqfr7bdE