Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Complex Random Question

Quote Reply
Complex Random Question
Hi there,

This is a question about how mysql appears to return information in asc or descending order only.
Is it capable of returning the information in random order.
In otherwords. I have a radio field called Listing_Type.
accepted values are Lodging, Events, Retail.
the query returns the links -
in ASC order: Events, Lodging, Retail or
in DESC order Retail, Lodging, Events.

Can it somehow be told to return it in any other order so
that it might return -
Lodging, Events, Retail or
Lodging, Retail, Events?

I can randomly choose an order, (ASC or DESC) but what other option if any is there?

using mysql 3.22.21

thanks for anyones help.

peace.


Quote Reply
Re: [klangan] Complex Random Question In reply to
Hi,

If you had MySQL 3.23, you can do ORDER BY RAND() to return results in random order. If you don't specify an order by, it will return them by insertion order. If you want them in a specific order, you probably need to do 3 queries (first where type = lodging, then where type = retail, then where type = events) and merge them together.

Hope this helps,

Alex
--
Gossamer Threads Inc.