RewriteEngine On
RewriteCond %{QUERY_STRING} ^limitstart=([0-9]*)$
RewriteRule ^(.+)$ /$1? [R=301,L]
<mymenu>
<menuitem><a href = "#">111</a></menuitem>
<menuitem><a href = "#">222</a></menuitem>
</mymenu>
SELECT *
INTO #tmp_search
FROM Товары
WHERE {условия поиска кроме рамера}
AND [размер] BETWEEN [ИскомыйРазмер] - 1 AND [ИскомыйРазмер] + 1
SELECT
FROM #tmp_search AS t1
INNER JOIN #tmp_search AS t2
WHERE t1.[артикул]<>t2.[артикул]
AND t2.[размер] BETWEEN t1.[размер] - 1 AND t1.[размер] + 1
AND t1.[размер] = {условие по искомому размеру}
SELECT a.[артикул], b.[артикул]
FROM Товары AS a
INNER JOIN Товары AS b
ON (a.[артикул]<>b.[артикул] AND a.[форма]=b.[форма] AND a.[цвет]=b.[цвет])
AND b.[размер] BETWEEN a.[размер]-1 AND a.[размер]+1
WHERE {условия поиска по a})
SELECT dt,
SUM(mx) AS sm
FROM
(
-- Максимальные значения по каждому каналу за каждый день
SELECT channel_id,
CAST(created_at AS DATE) AS dt,
MAX(participants_count) AS mx
FROM table
WHERE created_at BETWEEN @dateStart AND @dateFinish
GROUP BY channel_id, CAST(created_at AS DATE)
) AS t1
GROUP BY dt