答案 0 :(得分:1)
首先,您需要定义这些操作的内容。然后你可以做一个CASE WHEN THEN子句或UNION ALL合并。
SELECT *
/* do operation #1 */
FROM table
WHERE Seq = 1
UNION ALL
SELECT *
/* do operation #2 */
FROM table
WHERE Seq = 2
或者您可以使用GROUP BY来聚合函数,例如SUM:
SELECT Seq, SUM(cost) AS Total
FROM table
GROUP BY Seq
应该输出:
Seq Total
1 4400
2 56400