TennesseeGuy Posted April 8, 2006 Share Posted April 8, 2006 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 Link to comment https://forums.phpfreaks.com/topic/6866-simple-sql-question/ Share on other sites More sharing options...
westnyorai Posted April 9, 2006 Share Posted April 9, 2006 [!--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. Link to comment https://forums.phpfreaks.com/topic/6866-simple-sql-question/#findComment-25118 Share on other sites More sharing options...
fenway Posted April 9, 2006 Share Posted April 9, 2006 Actually, you can do this in a single query:[code]"SELECT * FROM $table ORDER BY FIELD( $fieldheader, 'F' ), $fieldheader"[/code] Link to comment https://forums.phpfreaks.com/topic/6866-simple-sql-question/#findComment-25290 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.