Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #10392

Re: sql order but move some rows bottom

Date 2013-08-04 19:36 +0200
From Luuk <luuk@invalid.lan>
Newsgroups comp.lang.php, alt.php
Subject Re: sql order but move some rows bottom
References (2 earlier) <13413lih7j7xy.ntybohdhh9wy.dlg@40tude.net> <frnvca-j63.ln1@luuk.invalid.lan> <19m253q4wpnqg.3aexf4o8h0ae$.dlg@40tude.net> <1l02da-q4u.ln1@luuk.invalid.lan> <1tsi9ibmoa4l7$.ni03ixud0whf$.dlg@40tude.net>
Message-ID <v1g2da-vl1.ln1@luuk.invalid.lan> (permalink)

Cross-posted to 2 groups.

Show all headers | View raw


On 04-08-2013 16:56, nawfer wrote:
> Il Sun, 04 Aug 2013 15:13:38 +0200, Luuk ha scritto:
>
> ok wonderful
> newly thanks
>   how really champion (your) last finishing touch
> I assuming case where there is a row that have 100 and y
> 	
> ORDER BY (column2 = 100 or column3='Y') ASC, column1 ASC, column2 ASC
> 6 			
> 7 			
> 8 			
> 1    100 		
> 1    100 			
> 2          y 	
> 4          y
> 5          y	
> 5    100   y 	
> 5    100
> 7    100	
>
> .......................................................................
> 1) y before 100:
> ORDER BY
> (CASE WHEN column2 = 100 THEN 2 ELSE 0 END + CASE WHEN column3='Y' THEN
> 1 ELSE 0 END) ASC, column1 ASC, column2 ASC
>
> 6 			
> 7 			
> 8
> 2         y	
> 4         y
> 5         y		
> 1    100 		
> 1    100
> 5    100 	
> 7    100 	
> 5    100  y
>
> in this case row  100 y is in the 'group' of the 100 rows; set at the '100
> group's end; is possible have first? so:
> 2         y	
> 4         y
> 5         y
> 5    100  y
> 1    100 		
> 1    100
> 5    100 	
> 7    100 	
>
>
> ........................................................................
> 2) 100 before y
> ORDER BY
> (CASE WHEN column2 = 100 THEN 1 ELSE 0 END + CASE WHEN column3='Y' THEN
> 2 ELSE 0 END) ASC, column1 ASC, column2 ASC
>
>
> 6 			
> 7 			
> 8
> 1    100 		
> 1    100
> 5    100 	
> 7    100
> 2         y	
> 4         y
> 5         y
> 5    100  y
>
> in this case row  100 y is in the 'group' of the y rows
> set at the 'y group's end; is possible have first? so:
> 1    100 		
> 1    100
> 5    100 	
> 7    100
> 5    100  y
> 2         y	
> 4         y
> 5         y
>

If you understood the example i gave you, you should be able to figure 
that part out yourself!

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

sql order but move some rows bottom nawfer <novalidsforspam@alt.al> - 2013-08-03 12:44 +0200
  Re: sql order but move some rows bottom Luuk <luuk@invalid.lan> - 2013-08-03 12:53 +0200
    Re: sql order but move some rows bottom nawfer <novalidsforspam@alt.al> - 2013-08-03 18:10 +0200
      Re: sql order but move some rows bottom Luuk <luuk@invalid.lan> - 2013-08-03 18:31 +0200
        Re: sql order but move some rows bottom nawfer <novalidsforspam@alt.al> - 2013-08-04 13:50 +0200
          Re: sql order but move some rows bottom Luuk <luuk@invalid.lan> - 2013-08-04 15:13 +0200
            Re: sql order but move some rows bottom anver <NOSPAMM@NO.SPAMMS> - 2013-08-04 16:42 +0200
            Re: sql order but move some rows bottom nawfer <novalidsforspam@alt.al> - 2013-08-04 16:56 +0200
              Re: sql order but move some rows bottom Luuk <luuk@invalid.lan> - 2013-08-04 19:36 +0200
                Re: sql order but move some rows bottom nawfer <novalidsforspam@alt.al> - 2013-08-04 19:52 +0200
                Re: sql order but move some rows bottom nawfer <novalidsforspam@alt.al> - 2013-08-05 14:50 +0200
            Re: sql order but move some rows bottom nawfer <novalidsforspam@alt.al> - 2013-08-04 17:49 +0200
              Re: sql order but move some rows bottom Luuk <luuk@invalid.lan> - 2013-08-04 19:37 +0200
                Re: sql order but move some rows bottom nawfer <novalidsforspam@alt.al> - 2013-08-04 19:53 +0200
                Re: sql order but move some rows bottom Luuk <luuk@invalid.lan> - 2013-08-04 20:20 +0200
                Re: sql order but move some rows bottom nawfer <novalidsforspam@alt.al> - 2013-08-05 14:57 +0200

csiph-web