由于必须在group子句中指定所有列以选择子句,因此我无法避免它。但有什么方法可以隐藏吗?
SELECT c.name,
p.company,
SUM(p.qty) as "Total Shares",
AVG(p.qty*p.price) as "Average Of Total Shares"
FROM purchase p, client c
WHERE c.clno = p.clno
GROUP BY company,
name;
我需要隐藏p.company。有谁能提出一个想法?
答案 0 :(得分:1)
请勿将其包含在select子句中(即使它出现在Group BY子句中)。
SELECT
c.name,
SUM(p.qty) as "Total Shares",
AVG(p.qty*p.price) as "Average Of Total Shares"
FROM purchase p, client c
WHERE c.clno = p.clno
GROUP BY company, name;