передавались массивом
SELECT p.*,
group_concat(sizes separator ', ') as sizes_product
FROM products p,
sizes s
WHERE id_product = product_size
GROUP BY name_product
select t.id,
t.title,
count(*) count_comments
from topics t
left join comments c on c.topic_id = t.id
left join topics_views v on v.topic_id = t.id
where (v.user_id = ?
and c.date_added > v.date_last_view) or v.date_last_view is null
group by t.id,
t.title
-- Cleaning wp_commentmeta
SELECT *
FROM wp_commentmeta
WHERE comment_id NOT IN (SELECT comment_id FROM wp_comments);
DELETE FROM wp_commentmeta
WHERE comment_id NOT IN (SELECT comment_id FROM wp_comments);
SELECT *
FROM wp_commentmeta
WHERE meta_key LIKE '%akismet%';
DELETE FROM wp_commentmeta
WHERE meta_key LIKE '%akismet%';
-- Cleaning wp_postmeta table
SELECT *
FROM wp_postmeta pm
LEFT JOIN wp_posts wp ON wp.ID = pm.post_id
WHERE wp.ID IS NULL;
DELETE pm
FROM wp_postmeta pm
LEFT JOIN wp_posts wp ON wp.ID = pm.post_id
WHERE wp.ID IS NULL;
sum (case when order.id is null then 0 else 1 end) order,
sum (case when cat.id is null then 0 else 1 end) cat,
prod.name,
prod.product_id
SELECT partnum,
LAG(partnum) OVER w AS 'prev_partnum',
partnum - LAG(partnum) OVER w AS 'diff'
FROM nspcl
WINDOW w AS (ORDER BY id);