日期:2014-05-18  浏览次数:20516 次

两个表时间字段名不同,union后的order by该怎样写?
SELECT     title,   times   FROM     item1     WHERE   title   LIKE   '% "   +   Replace(Recordset1__MMColParam,   " ' ",   " ' ' ")   +   "% '         Union   all   (SELECT     title,   addtimes   as   times   FROM   item2     WHERE   title   LIKE   '% "   +   Replace(Recordset1__MMColParam,   " ' ",   " ' ' ")   +   "% '   order   by   ....写times?addtimes?怎么写?

------解决方案--------------------
select * from
(
SELECT title, times FROM item1 WHERE title LIKE '% " + Replace(Recordset1__MMColParam, " ' ", " ' ' ") + "% '
Union all
(SELECT title, addtimes as times FROM item2 WHERE title LIKE '% " + Replace(Recordset1__MMColParam, " ' ", " ' ' ") + "% '
) t
order by times