Ver Mensaje Individual
  #4 (permalink)  
Antiguo 15/03/2009, 15:13
jurena
Colaborador
 
Fecha de Ingreso: marzo-2008
Ubicación: Cáceres
Mensajes: 3.735
Antigüedad: 16 años, 1 mes
Puntos: 300
Respuesta: Ordenar registros por sus precios que están en otra tabla

SELECT tp.id, tp.categoria, tp.nombre, tp.entradilla, tp.descripcion, tp.pclaves_buscador, tp.destacado, tp.visible, tdp.precio, tdp.nombre, tdp.descripcion FROM tienda_productos tp INNER JOIN tienda_precios tdp ON tp.id = tdp.id_articulo INNER JOIN (SELECT id_articulo, MIN(precio) preciominimo GROUP BY id_articulo)t1 ON tp.id = t1.id_articulo and tdp.precio = t1.preciominimo

No lo he probado.