1

Topic: ORDER BY parameter adjustment

Good evening!
There is a field int and the data:
12
2
23
5
8
1
Now at sorting Order BY produces result:
1
12
2
23
5
8
How to change ascending sort order?
1
2
5
8
12
23
In advance I thank!

2

Re: ORDER BY parameter adjustment

VinniL;

wrote:

There is a field int and given

Let it will be valid int

3

Re: ORDER BY parameter adjustment

You any tell fairy tales:

select
*
from (
select 12
union all select 2
union all select 23
union all select 5
union all select 8
union all select 1
) a (a)
order by
a.a
-----------------------------------------------------
a
-----------
1
2
5
8
12
23

4

Re: ORDER BY parameter adjustment

VinniL;
Or the field not Int, or is conversion Int by the line for sorting.
The first dares Cast (SortValue as Int)
The second - the forced switching-on of an Int-field in sorting (Order By SortValue, [a sorting Old regime])

5

Re: ORDER BY parameter adjustment

The strange table - the table of the smoker.
cast (value as int) does not help.
Probably that for the whole table sorting is disconnected?
How it is possible to include sorting in request?

6

Re: ORDER BY parameter adjustment

VinniL wrote:

the Strange table - the table of the smoker.

and a script of creation of this table show.

7

Re: ORDER BY parameter adjustment

VinniL wrote:

it is possible that for the whole table sorting is disconnected?
How it is possible to include sorting in request?

you there stop consciousness to expand, aha?

8

Re: ORDER BY parameter adjustment

The grandfather;
It from SQL-EX. The table "Painting"

9

Re: ORDER BY parameter adjustment

VinniL;
With a question understood.
The branch - http://www.sql.ru/forum/760004/kak-vybr … s-id-strok helped
In particular SELECT ROW_NUMBER () OVER (ORDER BY [a column])