SELECT g.*
FROM table_goods g
JOIN table_goods_params p1 ON p1.goods_id = g.id AND p1.param_id = 10 AND p1.value = "значение1"
JOIN table_goods_params p2 ON p2.goods_id = g.id AND p2.param_id = 11 AND p2.value = "значение2"
WHERE g.price > '50'
SELECT
COUNT(DISTINCT u1.id) first_level_refs_count,
COUNT(DISTINCT u2.id) second_level_refs_count,
COUNT(DISTINCT u3.id) third_level_refs_count
FROM users u1
LEFT JOIN users u2 ON u2.ref = u1.username
LEFT JOIN users u3 ON u3.ref = u2.username
WHERE u1.ref = ?
SELECT i.name
FROM `items` i
JOIN `item_attribute` ia ON ia.item_id = i.id AND ia.attribute_id = :aid
JOIN `values` v ON v.attribute_id = ia.attribute_id
WHERE v.value > 10
-- Запрос на выборку всех квартир, свободных на определенную дату
SELECT * FROM Apartment a
WHERE NOT EXISTS (
SELECT 1 FROM Apartment_Dates
WHERE apartment_id = a.id AND ? BETWEEN arrival_time AND departure_time
);
-- Запрос на выборку всех квартир, свободных в определенный промежуток дат
SELECT * FROM Apartment a
WHERE NOT EXISTS (
SELECT 1 FROM Apartment_Dates
WHERE apartment_id = a.id AND
(arrival_time BETWEEN ? AND ? OR departure_time BETWEEN ? AND ?)
);
-- Запрос на выборку всех квартир, занятых в определенный промежуток дат
SELECT * FROM Apartment a
WHERE EXISTS (
SELECT 1 FROM Apartment_Dates
WHERE apartment_id = a.id AND
(arrival_time BETWEEN ? AND ? OR departure_time BETWEEN ? AND ?)
);
location ~ ^.*\/([^\/]+)$ {
include uwsgi_params;
uwsgi_buffers 8 128k;
uwsgi_read_timeout 30;
uwsgi_pass unix:///tmp/$1.sock;
uwsgi_param UWSGI_CHDIR /var/www/html/$1;
uwsgi_param UWSGI_PYHOME /var/www/html/$1;
uwsgi_param UWSGI_FILE /var/www/html/$1/$1.py;
}
$input = [
'bar' => [],
'foo' => [],
'kuu' => [],
]
$result = uksort($input, function ($k1, $k2) {
return strcasecmp($b, $a);
});
SELECT id, SUBSTRING_INDEX(SUBSTRING_INDEX(groups, ',', g.n), ',', -1) groupName
FROM (
SELECT @n:=@n+1 n FROM
(select 0 union all select 1 union all select 3 union all select 4 union all select 5 union all select 6 union all select 6 union all select 7 union all select 8 union all select 9) s0,
(select 0 union all select 1 union all select 3 union all select 4 union all select 5 union all select 6 union all select 6 union all select 7 union all select 8 union all select 9) s1,
(SELECT @n:=0) sg
) g
JOIN Item ON CHAR_LENGTH(groups)-CHAR_LENGTH(REPLACE(groups, ',', '')) >= g.n-1
ORDER BY id, n
$_SERVER['HTTP_REFERER']