Re: SQL switcheroo

2003-01-29 Thread the hatter
On Wed, 29 Jan 2003, Paul Makepeace wrote: So there are a bunch of things order by rank. I'd like to implement a move up/down in SQL. So say the target was id=20 moving up, I'd like its rank to become 1, and id=10's rank to become 2. $query = UPDATE fw SET

Re: SQL switcheroo

2003-01-29 Thread David Cantrell
On Wed, Jan 29, 2003 at 02:16:58AM +, Paul Makepeace wrote: I'd like to switch the values of a field in two rows. 1-2 while 2-1, say. I have a table containing: = select * from pageplans order by rank; id | parent | child | rank | loopable | required

Re: SQL switcheroo

2003-01-29 Thread Paul Makepeace
On Wed, Jan 29, 2003 at 01:48:04PM +, David Cantrell wrote: On Wed, Jan 29, 2003 at 02:16:58AM +, Paul Makepeace wrote: I'd like to switch the values of a field in two rows. 1-2 while 2-1, say. I have a table containing: = select * from pageplans order by rank; id |

Re: SQL switcheroo

2003-01-29 Thread Paul Makepeace
On Wed, Jan 29, 2003 at 12:10:38PM +, the hatter wrote: On Wed, 29 Jan 2003, Paul Makepeace wrote: So there are a bunch of things order by rank. I'd like to implement a move up/down in SQL. So say the target was id=20 moving up, I'd like its rank to become 1, and id=10's rank to

Re: SQL switcheroo

2003-01-29 Thread Tim Sweetman
Not wanting to be awkward or anything, but ... Paul Makepeace wrote: On Wed, Jan 29, 2003 at 12:10:38PM +, the hatter wrote: On Wed, 29 Jan 2003, Paul Makepeace wrote: So there are a bunch of things order by rank. I'd like to implement a move up/down in SQL. So say the target was

Re: SQL switcheroo

2003-01-29 Thread Paul Makepeace
On Thu, Jan 30, 2003 at 12:13:04AM +, Paul Makepeace wrote: On Wed, Jan 29, 2003 at 12:10:38PM +, the hatter wrote: On Wed, 29 Jan 2003, Paul Makepeace wrote: So there are a bunch of things order by rank. I'd like to implement a move up/down in SQL. So say the target was id=20

SQL switcheroo

2003-01-28 Thread Paul Makepeace
I'd like to switch the values of a field in two rows. 1-2 while 2-1, say. I have a table containing: = select * from pageplans order by rank; id | parent | child | rank | loopable | required ++---+--+--+-- 3 | 2 | 5 |1 | f| t 5 |