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

Я не специалист по Sybase, но можно пример запроса в студию? Хочу понять ситуацию.
...
Рейтинг: 0 / 0
Срочно! Не работает order by
    #33177300
Фотография Dolphina
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
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
Срочно! Не работает order by
    #33177344
Фотография Рыжий Кот
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
мануал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
Срочно! Не работает order by
    #33177695
*ON*
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
ну да и asc или desc указать - принцип сортировки...
...
Рейтинг: 0 / 0
5 сообщений из 5, страница 1 из 1
Форумы / Sybase ASA, ASE, IQ [игнор отключен] [закрыт для гостей] / Срочно! Не работает order by
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


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