Usando Union All y Order By en MySQL
Tengo 2 mesas:
create table advertised_products(id int,title varchar(99),timestamp timestamp);
insert advertised_products select 1,'t1',curdate();
create table wanted_products(id int,title varchar(99),timestamp timestamp);
insert wanted_products select 1,'t1',now();
Estoy usando esta consulta para obtener los registros:
(
SELECT
ap.*,
'advertised' as type
FROM advertised_products as ap
)
union all
(
SELECT
wp.*,
'wanted' as type
FROM wanted_products as wp
)
ORDER BY timestamp desc limit 3
Pero da error:
La columna 'timestamp' en la cláusula de orden es ambigua
¿Cómo puedo ordenar esto?