sql - Sybase - FROM 子句中的子查询

标签 sql sap-ase

我使用的是 Sybase ASE 12.5.0.3,但无法执行以下子查询:

select * from (select '1' union select '2' ) X

我一直在环顾四周,据我所知在 Sybase ASE 12 之后应该是可能的,我做错了什么,还是这个版本不可能???

编辑 - 即使在将查询更改为:
select * from (select '1' as col1 union select '2' as col1 ) X

因此,即使为列提供别名,它仍然会失败......

最佳答案

在没有看到错误消息的情况下,您似乎需要在子查询中提供列别名:

select * 
from 
(
    select '1' as yournewCol 
    union 
    select '2' as yournewCol
) X

关于sql - Sybase - FROM 子句中的子查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12268571/

相关文章:

python - 警告 : (1265L, u“第 1 行 'test_end_date' 列的数据被截断”)

mysql - 合并两个表中的数据 SQL

character-encoding - Sybase ASE : show the character encoding used by the database

sybase - 在 syBase 中列出数据库中的所有表

php - MySQL:选择列包含列表中元素的行

php - 错误代码 : 1054. 'FabricName' 中的未知列 'field list'

asp.net - SYBASE ODBC .Net 核心

python - Sybase sybpydb 查询不返回任何内容

sql - 从 Postgresql 中的给定子项获取父项的整个层次结构