Гость
Целевая тема:
Создать новую тему:
Автор:
Форумы / Sybase ASA, ASE, IQ [игнор отключен] [закрыт для гостей] / Срочно! Не работает order by / 5 сообщений из 5, страница 1 из 1
21.07.2005, 09:41
    #33177227
Dolphina
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Срочно! Не работает order by
В каком случае на SASE может не работать
order by?
...
Рейтинг: 0 / 0
21.07.2005, 10:04
    #33177281
www.fun4me.narod.ru
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Срочно! Не работает order by
Закомментарен?

Я не специалист по Sybase, но можно пример запроса в студию? Хочу понять ситуацию.
...
Рейтинг: 0 / 0
21.07.2005, 10:12
    #33177300
Dolphina
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Срочно! Не работает order by
select QQ1, QQ2, QQ3 from QQ
where QQ3 in (1,2)
union
select QQ1, QQ2, QQ3 from QQ
where QQ3 in (2,3)
union
select QQ1, QQ2, QQ3 from QQ
where QQ3 in (3,1)
order by QQ3

посортирует без учета union
такое ощущение что order by
не действует на union
...
Рейтинг: 0 / 0
21.07.2005, 10:23
    #33177344
Рыжий Кот
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Срочно! Не работает order by
мануалselect-statement
UNION [ ALL | DISTINCT ] select-statement
[ UNION [ ALL | DISTINCT ] select-statement ] ...
[ ORDER BY integer [ ASC | DESC ], ... ]

Usage
The results of several SELECT statements can be combined into a larger result using UNION. The component SELECT statements must each have the same number of items in the select list, and cannot contain an ORDER BY clause.

The results of UNION ALL are the combined results of the component SELECT statements. The results of UNION are the same as UNION ALL, except that duplicate rows are eliminated. Eliminating duplicates requires extra processing, so UNION ALL should be used instead of UNION where possible. UNION DISTINCT is identical to UNION.

If corresponding items in two select lists have different data types, Adaptive Server Anywhere will choose a data type for the corresponding column in the result and automatically convert the columns in each component SELECT statement appropriately.

If ORDER BY is used, only integers are allowed in the order by list. These integers specify the position of the columns to be sorted.

The column names displayed are the same column names that are displayed for the first SELECT statement. An alternative way of customizing result set column names is to use the WITH clause on the SELECT statement.

наверное надо написать order by 3

...
Рейтинг: 0 / 0
21.07.2005, 12:30
    #33177695
*ON*
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Срочно! Не работает order by
ну да и asc или desc указать - принцип сортировки...
...
Рейтинг: 0 / 0
Форумы / Sybase ASA, ASE, IQ [игнор отключен] [закрыт для гостей] / Срочно! Не работает order by / 5 сообщений из 5, страница 1 из 1
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]