Re: Order By question



AH HA! You *DO* understand!
:-)
Is there a way to do that via sql?

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.


.



Relevant Pages

  • Re: SQL Runs in Access and not in ASP: 0x80040E10 Too few parameters
    ... Your expression is saying the equivalent of ... > These elements of my SQL string will come from variables in the ... Do you get the results you intend to get? ... Please reply to the newsgroup. ...
    (microsoft.public.inetserver.asp.db)
  • Re: Newbie. Reports & SQL.
    ... Yes basically what I was saying was that. ... zero out the consultant total. ... That involves writing SQL to produce a SUM value for each ...
    (comp.lang.pascal.delphi.misc)
  • Re: sql Statement Date object
    ... he is saying you should use a parameterized query. ... >> For your datetime column, you might have better luck by passing a ... >>> I have an ASP.net application with a connection to a sql database. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Im having trouble with SQL
    ... > ENoResultSet saying that the BDE can't find the cursor handle. ... > SELECT statement to the SQL command, ... I remember seeing some SQL command in the InterBase SQL ... In the BDE ...
    (comp.lang.pascal.delphi.misc)
  • Re: php and flatfiles
    ... >>In a webserver context, you should now be accessing your SQL using ... > web server, so saying that people should "now" be using it is a bit ...
    (uk.net.web.authoring)