Клавиатурный нейротренажёр Андреева
По любым вопросам пишите в телеграм автору
Прочитайте описание функций
Для регистрации отключите блокировку рекламы!
Для оплаты НЕ Российской картой пишите в личку
SELECT c.id AS cid, c.title AS ctitle, g.id AS gid, g.title AS gtitle, IF (i2.id IS NULL, i.id, i2.id) AS image_id FROM photo_category AS c JOIN photo_gallery AS g ON (g.c_id=c.id AND c.is_published AND g.is_published) JOIN photo_image AS i ON (i.g_id = g.id AND i.is_published) LEFT JOIN photo_image AS i2 ON (i2.g_id = g.id AND i2.is_main_foto) WHERE c.id = 1 GROUP BY g.id HAVING COUNT(i.id) > 0 ORDER BY c.ordi, g.ordi, i.ordi;
SELECT ordi, id, title FROM photo_image WHERE EXISTS (SELECT i.id FROM photo_category AS c JOIN photo_gallery AS g ON (g.c_id=c.id AND c.is_published AND g.is_published) JOIN photo_image AS i ON (i.g_id = g.id AND i.is_published) WHERE i.id = 1) AND g_id = (SELECT g_id FROM photo_image WHERE id = 1) AND (ordi = (SELECT MAX(ordi) FROM photo_image WHERE is_published AND g_id = (SELECT g_id FROM photo_image WHERE id = 1) AND ordi < (SELECT ordi FROM photo_image WHERE id = 1)) OR ordi = (SELECT MIN(ordi) from photo_image WHERE is_published AND g_id = (SELECT g_id FROM photo_image WHERE id = 1) AND ordi > (SELECT ordi FROM photo_image WHERE id = 1)) OR id = 1);