A patch for the GROUP BY/HAVING example. p.date should be s.date.

Robert B. Easter
This commit is contained in:
Bruce Momjian 2001-02-01 19:13:47 +00:00
parent 58f882d4b2
commit a1c68b4e6b
1 changed files with 2 additions and 2 deletions

View File

@ -1,4 +1,4 @@
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/queries.sgml,v 1.1 2001/01/22 23:34:33 petere Exp $ -->
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/queries.sgml,v 1.2 2001/02/01 19:13:47 momjian Exp $ -->
<chapter id="queries">
<title>Queries</title>
@ -531,7 +531,7 @@ SELECT pid AS "Products",
p.name AS "Over 5000",
(sum(s.units) * (p.price - p.cost)) AS "Past Month Profit"
FROM products p LEFT JOIN sales s USING ( pid )
WHERE p.date > CURRENT_DATE - INTERVAL '4 weeks'
WHERE s.date > CURRENT_DATE - INTERVAL '4 weeks'
GROUP BY pid, p.name, p.price, p.cost
HAVING p.price > 5000;
</programlisting>