Eh, stiglo resenje, cisto da neko ne gubi vreme:
Citat:
SELECT category_recipe.rec_id, category_recipe.cat_id, r.name, r.url, r.main_image, c.id, c.title
FROM (
(
SELECT category_recipe . *
FROM category_recipe
WHERE cat_id =10
ORDER BY rand( )
LIMIT 4
)
UNION ALL (
SELECT category_recipe . *
FROM category_recipe
WHERE cat_id =30
ORDER BY rand( )
LIMIT 4
)
UNION ALL (
SELECT category_recipe . *
FROM category_recipe
WHERE cat_id =64
ORDER BY rand( )
LIMIT 4
)
)category_recipe
JOIN categories c ON category_recipe.cat_id = c.id
JOIN recipes r ON category_recipe.rec_id = r.id
|
Prvim upitom vadim random id-ove kategorija, pa ih smestam u ovaj... E, sad, naravno, morao sam da odradim dodatni upit za 9 random recepata (thumbovi), sto je ukupno 3, samo za slideshow... Page caching 100% pada, druge nema, s obzirom na sve ovo...