Re: [SQL] ORDER BY question

2006-05-10 Thread Michael Glaesemann
On May 11, 2006, at 21:00 , Christian Paul Cosinas wrote: For example I have a table like this ID Name 1 A 1 B 2 C 2 D And I have a Query like this: SELECT * FROM table ORDER BY ID. Would my result always give me the same order or is there may be a possible di

[SQL] ORDER BY question

2006-05-10 Thread Christian Paul Cosinas
Hi, For example I have a table like this ID Name 1 A 1 B 2 C 2 D And I have a Query like this: SELECT * FROM table ORDER BY ID. Would my result always give me the same order or is there may be a possible different result? For example? 1 B 1 A 2 D

Re: [SQL] order by question

2005-03-09 Thread Greg Stark
Gary Stainburn <[EMAIL PROTECTED]> writes: > > Alternatively: (a<>6),(a<>4),a > > Although this does exactly what I want, at first glance it should do > exactly the opposite. > > I'm guessing that for each line it evaluates > not (a=6) 0 for true else 1 Not really, "not a=6" is an expression t

Re: [SQL] order by question

2005-03-09 Thread Bruno Wolff III
On Wed, Mar 09, 2005 at 12:41:55 +, Gary Stainburn <[EMAIL PROTECTED]> wrote: > Hi folks. > > I seem to remember somewhere being shown how to bump specific rows to > the top of a list; something along the lines of: > > select c_id as key, c_des as value from customers order by c_id = 7, >

Re: [SQL] order by question

2005-03-09 Thread Gary Stainburn
On Wednesday 09 March 2005 1:06 pm, you wrote: > Gary Stainburn wrote: > > Hi folks. > > > > I seem to remember somewhere being shown how to bump specific rows > > to the top of a list; something along the lines of: > > > > select c_id as key, c_des as value from customers order by c_id = > > 7, c_

Re: [SQL] order by question

2005-03-09 Thread Achilleus Mantzios
O Gary Stainburn έγραψε στις Mar 9, 2005 : > Hi folks. > > I seem to remember somewhere being shown how to bump specific rows to > the top of a list; something along the lines of: > > select c_id as key, c_des as value from customers order by c_id = 7, > c_id = 160, value; use the case ... w

Re: [SQL] order by question

2005-03-09 Thread Richard Huxton
Gary Stainburn wrote: Hi folks. I seem to remember somewhere being shown how to bump specific rows to the top of a list; something along the lines of: select c_id as key, c_des as value from customers order by c_id = 7, c_id = 160, value; Looks roughly right. SELECT * FROM foo ORDER BY not(a=6),

[SQL] order by question

2005-03-09 Thread Gary Stainburn
Hi folks. I seem to remember somewhere being shown how to bump specific rows to the top of a list; something along the lines of: select c_id as key, c_des as value from customers order by c_id = 7, c_id = 160, value; however, although the statement is accepted the two rows specified are not b

Re: [SQL] Order By Question

2001-01-23 Thread Prasanth Kumar
> This seems like the answer must be pretty easy, but I can't think of it: > > In the following statement: > > select field1 from my_table where field2 in (3, 1, 2); > > How can I modify this statement so that the record are returned in the > order of first those records having field2 = 3, then f

[SQL] Order By Question

2001-01-23 Thread Tristan Colson
This seems like the answer must be pretty easy, but I can't think of it: In the following statement: select field1 from my_table where field2 in (3, 1, 2); How can I modify this statement so that the record are returned in the order of first those records having field2 = 3, then field2 = 1, the

[SQL] Order By Question

2001-01-23 Thread Tristan Colson
This seems like the answer must be pretty easy, but I can't think of it: In the following statement: select field1 from my_table where field2 in (3, 1, 2); How can I modify this statement so that the record are returned in the order of having field2 = 3, then field2 = 1, then field2 = 2. As it