[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: MySQL ORDER BY or PHP Sort? Oops.
This would be pretty ugly, but you could adapt a trick that was posted to
the MySQL list back in Sept.
select * from ... where series != "Baby", series != "Genesis", series !=
"Super", etc.
Like I said, ugly, and I don't know how efficient it would be (probably
not very), but it would get the job done. Otherwise, I agree with the
previous post to assign a sort order number to each series type. Much
cleaner, more efficient, and more flexible.
On Monday, December 3, 2001, at 04:28 PM, René Fournier wrote:
One more thing, very important: I want to specify the Series sort order,
not alphabetically, but by a non-obvious way (Baby>Genesis>Super>Predator>
Millennium)...
------
I want to select about 25 rows from a table, and sort them by two
criteria. First, by each row's Series field ("Baby", "Genesis", "Super",
"Predator", "Millennium" are the various Series, and the order I'd like
the rows in the array). Within each Series, I'd like the rows sorted by
their Price field, ascending. For example:
Baby $5
Baby $10
Baby $15
Genesis $20
Genesis $35
Genesis $50
...and so on.
Now, I know how to structure my MySQL Select statment such that the rows
it pulls from the table will be either sorted by Price OR by Series, but
not both, in the way I'd like. Does anyone know if it's possibly to do
this in the Select statement itself? (I'd rather do it that way, than
resort in PHP.)
Thanks!
...Rene
---
René Fournier
renefournier@xxxxxxxxx
David Felio
Software Developer
Information Network of Arkansas
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <mysql-thread92939@xxxxxxxxxxxxxxx>
To unsubscribe, e-mail <mysql-unsubscribe-treed=ultraviolet.org@xxxxxxxxxxxxxxx>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
This mailing list archive is a service of Copilot Consulting.