Order By

Results 1 to 2 of 2

Thread: Order By

  1. #1
    Join Date
    Dec 1969

    Default Order By

    in the dim an distant past i seem to remember somthing about being able to use the order by in a manner where it does not start ordering at A or 1<BR><BR>but can be set to set to start at say <BR>C,D...Y,Z,A,B <BR>or 5,6,7....N,1,2,3,4<BR><BR>anyone heard of this?

  2. #2
    Join Date
    Dec 1969

    Default Which database???

    Taking your two example:<BR><BR>C,D...Y,Z,A,B <BR>Access: ORDER BY IIF(Left(field,1) &#062;= &#039;C&#039;, 1, 2), field<BR>SQL Server: ORDER BY (CASE WHEN Left(field,1) &#062;= &#039;C&#039; THEN 1 ELSE 2 END), field<BR><BR>5,6,7....999,1,2,3,4<BR>Access: ORDER BY IIF(field &#062;= 5, 1000000+field, field)<BR>SQL Server: ORDER BY (CASE WHEN field &#062;= 5 Then 1000000+field ELSE field END)<BR><BR>For MySQL, same as Access but use "IF" instead of "IIF".<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts