答案 0 :(得分:5)
您需要聚合:
app.get('/page/', (req, res) => {
res.writeHead(200, { /* . . . */ });
res.write('\n');
req.on("close", () => {
// do something when the connection is closed
});
});
如果您希望每行恰好有两行,请改用SELECT t.col
FROM table t
GROUP BY t.col
HAVING COUNT(*) > 1;
。
如果需要所有行,则可以使用Windows函数:
COUNT(*) = 2
编辑:对问题进行更新后,您可能需要SELECT t.*
FROM (SELECT t.*,
COUNT(*) OVER(PARTITION BY col) AS cnt
FROM table t
) t
WHERE t.cnt > 1;
:
LEFT()
如果SELECT t.*
FROM (SELECT t.*,
COUNT(*) OVER(PARTITION BY CAST(Date_created AS date), LEFT(associated_ref, 7)) AS cnt
FROM table t
) t
WHERE t.cnt > 1 AND CAST(t.Date_created AS date) = '2019-02-08';
没有Date_created
,则不需要对话。只需使用time
。