I have two tables with data and need to combine them and order by date. I have the below query but the union keeps giving me an error.
SELECT
AssetTitle,
AssetDate,
AssetTeaser,
AssetLink
FROM pressAssets WHERE AssetType=1 ORDER BY AssetDate ASC
UNION ALL
SELECT
BlogTitle,
BlogDate,
BlogEntry,
BlogLink
FROM
blogTempTable ORDER BY BlogDate ASC, AssetDate ASC;
Can anyone help me with this?
Your code doesn’t work as is. This will get you a result set, but the date fields all get merged together; you can’t distinguish the source after the
UNIONis applied.