SELECT DISTINCT p.id AS id,
p.precio AS precio,
p.tipo_libro,
p.url_ebook,
p.autor AS autor,
p.activo AS activo
FROM producto AS p JOIN producto_categoria AS pd1
ON( p.id = pd1.producto_id AND pd1.categoria_id = '28' ) JOIN producto_categoria AS pd2
ON( p.id = pd2.producto_id AND pd2.categoria_id = '78' ) JOIN producto_categoria AS pd3
ON( p.id = pd3.producto_id AND pd3.categoria_id = '22' ) WHERE p.activo = 1 AND p.tipo_libro > 0 GROUP BY p.id