Darkness Soul Posted July 19, 2006 Share Posted July 19, 2006 Yo,I have a col, VIP, and this one have my order method.. 'a', 'b', 'c'.I need to, randomize the data, after, order the randomized by this vip col.. after, i want to order the 'c' row by ASC, like this idea: ORDER BY RAND() , vip DESC , nome_fantasia ASC ( WHERE vip = 'c' )Some solution?Thanks,D.Soul Quote Link to comment Share on other sites More sharing options...
fenway Posted July 19, 2006 Share Posted July 19, 2006 You want ORDER BY FIELD( vip, 'C' ) Quote Link to comment Share on other sites More sharing options...
Darkness Soul Posted July 20, 2006 Author Share Posted July 20, 2006 Hmmm.. thats a short one!What I've done to solute that problem was:[b]ORDER BY vip DESC , IF( vip = 'V' , RAND() , IF( vip = 'S' , RAND() , nomefantasia ))[/b]It works fine as wished! =)D.Soul Quote Link to comment Share on other sites More sharing options...
fenway Posted July 20, 2006 Share Posted July 20, 2006 That's much more work for the DB to do, especially the RAND()... not ideal,IMHO. Quote Link to comment Share on other sites More sharing options...
Darkness Soul Posted July 20, 2006 Author Share Posted July 20, 2006 yeah, I know.. and this order is with a union inside the sql string.. but.. they want it, they get it.. =)D.Soul 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.