From: Rodrigo Carvalhaes <grupos@carvalhaes.net>
Cc: pgsql-sql@postgresql.org
Subject: UPDATE WITH ORDER BY
Date: Tue, 26 Apr 2005 00:12:32 -0300
Message-ID: <426DB1A0.2000604@carvalhaes.net> (raw)
In-Reply-To: <20050425202406.GA3289@winnie.fuhr.org>
References: <fddc0c5705042511464f94be68@mail.gmail.com>
<20050425202406.GA3289@winnie.fuhr.org>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<div class="moz-text-html" lang="x-western">
<tt>Hi Guys!<br>
<br>
I need to make an UPDATE on a column reordering it with a sequence
using order by a description.<br>
Confusing??? Well.. Let me give an example...<br>
<br>
Today, my table it's organized like this:<br>
<br>
Code / Description<br>
9 Orange<br>
15 Apple<br>
1 Pear<br>
3 Tomato<br>
<br>
I wanna to reorganize (reordering the code from 1 to ... ordering by
description)<br>
</tt><tt><br>
Code / Description<br>
</tt><tt>1 Apple</tt><br>
<tt>2 Orange<br>
3 Pear<br>
4 Tomato</tt><br>
<tt><br>
I created a sequence but I am having no succes to use it because UPDATE
don't accept ORDER BY CLAUSE. The "ideal SQL" is UPDATE table SET code
= nextval('sequence') ORDER BY description <br>
<br>
I searched a lot on the NET without ant "tip" for my case. <br>
It's a very simple need but I am not able to solve it...<br>
<br>
Anyone knows how I can do it?<br>
<br>
Cheers,<br>
<br>
-- <br>
Rodrigo Carvalhaes<br>
<br>
</tt><!-- |**|end egp html banner|**| -->
</div>
</body>
<br />--
<br />Esta mensagem foi verificada pelo sistema de antivĂrus e
<br /> acredita-se estar livre de perigo.
</html>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: grupos@carvalhaes.net
Subject: Re: UPDATE WITH ORDER BY
In-Reply-To: <426DB1A0.2000604@carvalhaes.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox