Re: retrieve rows in a specified order

From: Bob Badour <bbadour_at_golden.net>
Date: Sat, 20 Dec 2003 16:28:43 -0500
Message-ID: <OtOdnQvJtci9InmiRVn-vA_at_golden.net>


"Melon" <maikel7_at_poczta.onet.pl> wrote in message news:3fe4b2ca_at_news.home.net.pl...
> I'm starting to work with mysql (but I think my post applies to other
> databases as well) and I've come across a problem - I've read in several
> sources that the order of retrieved rows by a SELECT statement is
> undefined unless you use GROUP BY or ORDER BY. Now I need to be able to
> fetch the rows in an order defined by me or the web site's owner.
> Imagine that each row represents one product in a shop. Now I need to
> let the shop owner decide in which order the products appear on a web
> page. He needs to be able to freely change this order at any time and
> move any product to any position he wants. What would be the easiest way
> to accomplish this in a database knowing I can't change the row order? I
> will be grateful for any ideas.
>
> Melon.

You need an attribute (column) that records the order or display position of the items on the page. Then it is a simple matter of ordering by that attribute. Received on Sat Dec 20 2003 - 22:28:43 CET

Original text of this message