legohead6 Posted December 23, 2006 Share Posted December 23, 2006 how would a query look for this? Quote Link to comment https://forums.phpfreaks.com/topic/31662-solved-sorting-alphabeticly-based-on-a-certain-row/ Share on other sites More sharing options...
trq Posted December 23, 2006 Share Posted December 23, 2006 If the field info is of the type varchar.[code]SELECT info FROM tbl;[/code] Quote Link to comment https://forums.phpfreaks.com/topic/31662-solved-sorting-alphabeticly-based-on-a-certain-row/#findComment-146765 Share on other sites More sharing options...
legohead6 Posted December 23, 2006 Author Share Posted December 23, 2006 o.. duh! umm so then "ORDER BY alphabetic"? Quote Link to comment https://forums.phpfreaks.com/topic/31662-solved-sorting-alphabeticly-based-on-a-certain-row/#findComment-146767 Share on other sites More sharing options...
trq Posted December 23, 2006 Share Posted December 23, 2006 Um... left off the most important part.[code]SELECT info FROM tbl ORDER BY info;[/code] Quote Link to comment https://forums.phpfreaks.com/topic/31662-solved-sorting-alphabeticly-based-on-a-certain-row/#findComment-146768 Share on other sites More sharing options...
Jessica Posted December 23, 2006 Share Posted December 23, 2006 You need an order clause - I just ran thorpe's example on a table to check, and it returned them in order of PK(I did SELECT username FROM users and they were in PK order.)Try SELECT rownames FROM tablename ORDER BY sortedrow ASC; Quote Link to comment https://forums.phpfreaks.com/topic/31662-solved-sorting-alphabeticly-based-on-a-certain-row/#findComment-146769 Share on other sites More sharing options...
trq Posted December 23, 2006 Share Posted December 23, 2006 ASC is default. Quote Link to comment https://forums.phpfreaks.com/topic/31662-solved-sorting-alphabeticly-based-on-a-certain-row/#findComment-146770 Share on other sites More sharing options...
Jessica Posted December 23, 2006 Share Posted December 23, 2006 Yep, it is :) Does it hurt to add it? I normally have sorting options so my ASC vs DSC is set in a variable, so I tend to add ASC anytime. If that causes a performance issue I'd take it out, but I think it's fine right? Quote Link to comment https://forums.phpfreaks.com/topic/31662-solved-sorting-alphabeticly-based-on-a-certain-row/#findComment-146772 Share on other sites More sharing options...
trq Posted December 23, 2006 Share Posted December 23, 2006 Yeah of course its fine. Its probably even more efficient to have it. It usually is more efficient to exlicitly enable things. Quote Link to comment https://forums.phpfreaks.com/topic/31662-solved-sorting-alphabeticly-based-on-a-certain-row/#findComment-146773 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.