【发布时间】:2020-03-20 10:27:57
【问题描述】:
我有 2 个表,我使用 union all 来合并这两个表。 我有 strCreatedOn 列作为时间戳。现在我无法在其中使用 order by 子句
select nVendorId,
'bank'as change_column,
nRequestType as change_type,
strCreatedOn as Timestamp,
nItemState as status
from vaamoz_admin.tblbankdetails
where nItemState = '1' AND nRequestType='4'
union all
select nVendorId,
'kyc' as change_column,
nRequestType as change_type ,
strCreatedOn as Timestamp,
nItemState as status
from vaamoz_admin.tblkycdetails
where nItemState = '1' AND nRequestType='4'
【问题讨论】:
-
用您正在使用的数据库标记您的问题。
-
@GordonLinoff 是的。
标签: mysql sql sql-order-by union