Re: Order By question
- From: "MP" <nospam@xxxxxxxxxx>
- Date: Thu, 2 Nov 2006 17:50:32 -0600
"Dmitriy Antonov" <antonovdima@xxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:eKuoLLg$GHA.2128@xxxxxxxxxxxxxxxxxxxxxxx
another way of saying the same thing...via very "pseudo" code
If F1 = '1n' Or F1 = '4B' then
'Order By F2'
Else
...some sql to produce the posted results for '2L' and '3R'
For Each Distinct F2
'Order By F1
Next F2
End If
Try this query:
Select F1, F2
From (
Select F1, F2,
IIf(F1='1n', 1, IIf(F1='4b',3,2)) As Ord1,
IIf(F1='1n' or F1='4b', F1, 100-Val(F2)) As Ord2
From TableName
)
Order By Ord1, Ord2, F1, F2 Desc
Dmitriy.
Hi Dmitriy,
I'm trying to understand your idea....
can you help?
in this line
IIf(F1='1n', 1, IIf(F1='4b',3,2)) As Ord1,
it looks as if you're specifying a new field name for the first select
If F1 = '1n' then newfieldname = 1
ElseIf F1 = '4b' then new field name = 3
Else new field name = 2
is that correct?
I'm confused since i don't have fields by that name how that's supposed to
work
then in the second iif
IIf(F1='1n' or F1='4b', F1, 100-Val(F2)) As Ord2
we get either a field name 'F1' or a value of 100 minus the value in F2...
Sorry but I'm just not getting it.
can you elaborate on your process?
Thanks
Mark
.
- Follow-Ups:
- Re: Order By question
- From: Dmitriy Antonov
- Re: Order By question
- References:
- Order By question
- From: MP
- Re: Order By question
- From: Jan Hyde
- Re: Order By question
- From: MP
- Re: Order By question
- From: Dmitriy Antonov
- Order By question
- Prev by Date: Re: delete a row in my table
- Next by Date: Re: Ado Recordset and stored procedure(SQL server 2000)
- Previous by thread: testing
- Next by thread: Re: Order By question
- Index(es):
Relevant Pages
|