为什么union中的order by 会失效?
(select suites.description as description,suites.id as id,users.ldap_uid as owner, clusters.name as cluster,
clusters.id as _clusters_id,suites.time_limit as _time_limit,suites.diff_folder as _diff_folder,
suites.recurrence as _recurrence, suites.ini_file as ini, suites.parent_group_id as
_parent_group_id,suite_groups.name as _parent_group_name,
concat_ws(' ',app_names.name, app_ver_major.ver_major, app_ver_minor.app_ver_minor) as application,
app_ver_major.id as _app_ver_major_id, app_ver_minor.id as _app_ver_minor_id, app_names.id as
_app_names_id, suites.baseline_folder as baseline
from suites join applications, app_names, app_ver_major, app_ver_minor, clusters, users,suite_groups on users.id =
suites.owner_id and applications.id = suites.application_id
and app_names.id = applications.app_name_id and app_ver_major.id = applications.app_ver_major_id and
app_ver_minor.id = applications.app_ver_minor_id and clusters.id = suites.cluster_id
and suites.parent_group_id = suite_groups.id
where suites.id =3194
order by suites.id desc)
union
(select "fill",suites.id as id,"fill", "fill", "fill" ,"fill","fill", "fill", "fill", "fill","fill",
"fill", "fill", "fill", "fill", suites.baseline_folder as baseline
from suites
where suites.suite_parent_id=3194 and suites.baseline_folder<>""
order by suites.id desc)
一个问题是在union中的order by suites.id desc失效了,输出的结果没有降序(若单独一个查询则成)
另外,不知道用"fill"填充以维持2个查询列匹配,这种做法是否能适用所有数据库,是否是标准的? 多谢了!