How to order zero values?

Using Access 2003

In my column of the table, some of the fields are null, some of them are a number, and some of them are a string

Table.

ID, Value

001 
002 N/A
003 01
004  
005 N/A
006 02

So...

I want to order a table by number, row, then zero values,

Request

Select identifier, value from order table by value

Expected Result

    ID, Values

    003 01
    006 02
    002 N/A
    005 N/A
    001
    004

Query Request Help

+3
source share
2 answers
  SELECT * FROM  
 (SELECT *, IIF(Val(Value) > 0, 2, IIF(ISNULL(Value), 3, 1)) AS MyOrder FROM MyTable)  
Order by MyOrder

EDIT: I think it is clear. Modified as per Robert's request;)

SELECT * FROM MyTable
ORDER BY IIF(Val(Value) > 0, 2, IIF(ISNULL(Value), 3, 1))
+2
source

Create a new query and paste the following SQL:

SELECT *
FROM Table1
ORDER BY IsNull([Text2]) DESC , Table1.Text2;

Change the names as necessary.

+5
source

Source: https://habr.com/ru/post/1712409/


All Articles