FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » sql order but move some rows bottom
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
sql order but move some rows bottom [message #182404] Sat, 03 August 2013 10:44 Go to previous message
nawfer is currently offline  nawfer
Messages: 34
Registered: August 2011
Karma:
Member
I would like to order a list; sorted by column 1,
but when the elements have the value 100,
move them at the end of the list

A)
if I have 2 columns
a 2
b 1
c 100
d 1
a 100
b 1
c 2
d 1

B)
to sort by column 1
a 2
a 100
b 1
b 1
c 2
c 100
d 1
d 1

C)
but make sure that when I 100 the row is moved under
a 2
b 1
b 1
c 2
d 1
d 1
a 100
c 100

how can solve both with sql and with php? I was interested in both
solutions although I prefer to understand first how can do with sql;

the sql after fill the php array;

if I use ORDER BY column1 ASC, (column2 = 100) ASC
in reality does how in B)
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: fetch items from a row
Next Topic: Validate Radio Buttons?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Mon Sep 16 18:55:42 GMT 2024

Total time taken to generate the page: 0.05455 seconds