Jump to content

Archived

This topic is now archived and is closed to further replies.

TennesseeGuy

Simple SQL Question

Recommended Posts

Is it possible to query your results, list them in ascending order but excluding one from the ascending order that neds to be added to the end? ie ordered after query: A,B,C,D,E,G,H,I,J,K,F

Share this post


Link to post
Share on other sites
[!--quoteo(post=362749:date=Apr 8 2006, 03:13 AM:name=TennesseeGuy)--][div class=\'quotetop\']QUOTE(TennesseeGuy @ Apr 8 2006, 03:13 AM) [snapback]362749[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Is it possible to query your results, list them in ascending order but excluding one from the ascending order that neds to be added to the end? ie ordered after query: A,B,C,D,E,G,H,I,J,K,F
[/quote]

$query="SELECT * FROM $table ORDER BY $fieldheader";
mysql_query($query);

that will arrange the data by field type. As far as placing only one at the end you would have to probably add a WHERE statement and have it list all except the one you wanted placed last. Then have it list the last one afterwards with another WHERE statement.

Share this post


Link to post
Share on other sites
Actually, you can do this in a single query:

[code]"SELECT * FROM $table ORDER BY FIELD( $fieldheader, 'F' ), $fieldheader"[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.