SELECT
r.id as req,
ss.id as ss_id,
ss.user_id as user,
min(ss.created_at) AS date
FROM seo_source AS ss
INNER JOIN seo_user_request AS su ON su.user_id = ss.user_id
INNER JOIN request as r ON r.id = su.request_id
GROUP BY ss.id
SELECT *
FROM video
INNER JOIN video AS video_main ON video.category1 = video_main.category1 AND video.category2 = video_main.category2
WHERE video_main.id = 100
SELECT *
FROM video
INNER JOIN video AS video_main ON video.category1 = video_main.category1 OR video.category2 = video_main.category2
WHERE video_main.id = 100
SELECT COUNT(*)
FROM joiners_tourdate
INNER JOIN joiners_country on joiners_tourdate.country_id = joiners_country.id
INNER JOIN joiners_artist on joiners_artist.id = joiners_tourdate.artist_id
WHERE joiners_tourdate.country_id = 3
... WHERE жанр = "" AND год = "" AND альбом = ""
CRAETE INDEX ... ON tabl(жанр, год, альбом)
... WHERE год = "" AND жанр = "" AND альбом = ""
$dbRes = CIBlockElement::GetList(
null,
array(
"IBLOCK_ID" => 3,
"PROPERTY_id_site" => 1
),
array("PROPERTY_id_advert"),
array("nTopCount" => 3),
array("PROPERTY_id_advert")
);