Ver Mensaje Individual
  #6 (permalink)  
Antiguo 24/05/2013, 01:34
Avatar de repara2
repara2
 
Fecha de Ingreso: septiembre-2010
Ubicación: München
Mensajes: 2.445
Antigüedad: 13 años, 7 meses
Puntos: 331
Respuesta: Paginar 2 consultas

Te quedaría una cosa así, pero tendrás que probar un poco, no tengo accesso a tu DB:

Código MySQL:
Ver original
  1. FROM principal
  2.   INNER JOIN categorias
  3.     ON principal.id_categoria = categorias.id_categoria
  4. WHERE categorias.id_categoria =  % s
  5.     AND principal.premium = 0 UNION SELECT *
  6.                                     FROM principal
  7.                                       INNER JOIN categorias
  8.                                         ON principal.id_categoria = categorias.id_categoria
  9.                                     WHERE categorias.IdPadre =  % s
  10.                                         AND principal.premium = 0
  11. ORDER BY id_principal DESC
  12.                                  FROM principal
  13.                                    INNER JOIN categorias
  14.                                      ON (principal.id_categoria = categorias.id_categoria)
  15.                                  WHERE categorias.id_categoria =  % s
  16.                                      AND premium = 1 UNION SELECT *
  17.                                                            FROM principal
  18.                                                              INNER JOIN categorias
  19.                                                                ON (principal.id_categoria = categorias.id_categoria)
  20.                                                            WHERE categorias.IdPadre =  % s
  21.                                                                AND premium = 1
  22.                                  ORDER BY id_principal DESC
__________________
Fere libenter homines, id quod volunt, credunt.