Commit 66fc528d authored by Tom Lane's avatar Tom Lane

Remove somebody's flight of fancy about an UPDATE with ORDER BY and LIMIT.

parent 4c0efd3a
<!-- <!--
$PostgreSQL: pgsql/doc/src/sgml/ref/update.sgml,v 1.36 2006/01/22 20:34:11 tgl Exp $ $PostgreSQL: pgsql/doc/src/sgml/ref/update.sgml,v 1.37 2006/03/08 22:59:09 tgl Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -232,20 +232,6 @@ UPDATE employees SET sales_count = sales_count + 1 WHERE id = ...@@ -232,20 +232,6 @@ UPDATE employees SET sales_count = sales_count + 1 WHERE id =
</programlisting> </programlisting>
</para> </para>
<para>
Now that all the papers are signed, update the most recently closed
deal of the travelling salesperson who closed the Rocket Powered
Skates deal with the Acme Corporation.
<programlisting>
UPDATE employees SET last_closed_deal = deal.id
FROM accounts JOIN deals ON (account.id = deal.account_id)
WHERE deal.employee_id = employees.id
AND deal.name = 'Rocket Powered Skates'
AND accounts.name = 'Acme Corporation'
ORDER BY deal.signed_date DESC LIMIT 1;
</programlisting>
</para>
<para> <para>
Attempt to insert a new stock item along with the quantity of stock. If Attempt to insert a new stock item along with the quantity of stock. If
the item already exists, instead update the stock count of the existing the item already exists, instead update the stock count of the existing
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment