如何组合两个SELECT
语句返回的列以给出它们的元素商数?
查询一:
SELECT COUNT(*) AS count
FROM table1
WHERE col2 = 1 AND col3 > 5
GROUP BY col4
ORDER BY col4
查询 2:
SELECT COUNT(*) AS count
FROM table1
WHERE col2 = 1
GROUP BY col4
ORDER BY col4
因此,如果他们返回如下内容:
Query 1 Query 2
count count
-----------------------
1 5
2 4
我会得到:
quotient
-------
0.2
0.5