deansatch Posted November 20, 2009 Share Posted November 20, 2009 I have my db and fetch theresults in alphabetical order using "select * from table order by name" but I need on of the entries to be next to another as a one-off exception. e.g Alfred Bob Malcolm <---the odd one Edward Frank George Larry Kyle Morris Norris Is there any way of doing this without creating an 'order' column and assigning numbers to every entry? Quote Link to comment Share on other sites More sharing options...
onlyican Posted November 20, 2009 Share Posted November 20, 2009 You can create a SortBy field in your table. Then populate the field with a numeric value to the order you would like Quote Link to comment Share on other sites More sharing options...
Mark Baker Posted November 20, 2009 Share Posted November 20, 2009 I need on of the entries to be next to another as a one-off exception.How do you identify which entry needs to be next to what other entry? Quote Link to comment Share on other sites More sharing options...
Mchl Posted November 20, 2009 Share Posted November 20, 2009 (SELECT * FROM table WHERE name = 'Malcolm') UNION (SELECT * FROM table WHERE name !='Malcolm' ORDER BY name) Quote Link to comment Share on other sites More sharing options...
fenway Posted November 25, 2009 Share Posted November 25, 2009 Or you can simply use an IF() in your ORDER BY clause. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.