For Programmers: Free Programming Magazines  


Home > Archive > PHP SQL > August 2004 > Is there a query...









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Is there a query...
tox_yray

2004-05-21, 3:31 pm

... to permanently move a row in a MySQL table? For example, I got
this table:

Name | # | Age
=============
Bruno | 1 | 17
Carl | 2 | 17
Emilie | 3 | 14
Marie | 4 | 17

Let's say for a page to show how I want it to show, I need my
table to look like this instead:

Name | # | Age
=============
Emilie | 3 | 14
Bruno | 1 | 17
Carl | 2 | 17
Marie | 4 | 17

Is there a way to just move the row #3 up to #1 by a query?



----------------------------------------
The post originated from PHP Freaks:
----------------------------------------
http://www.phpfreaks.com
http://www.phpfreaks.com/forums


Barand

2004-08-18, 3:57 pm

You don't need to move anything. Just sort it it when query the
table

--------
SELECT Name, Age FROM mytable ORDER BY Age, Name;
--------

Barand

http://members.aol.com/barryaandrew...agridguide.html easy
data tables - and more

----------------------------------------
The post originated from PHP Freaks:
----------------------------------------
http://www.phpfreaks.com
http://www.phpfreaks.com/forums


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com