image.png
.with recursive cte(id, title, url, hierarchy) as (
SELECT
id,
title,
url,
null::text as hierarchy
from
site_resources
where
parent = 0
--and published = 1 AND template = 10 --В условиях задачи не сказано про эти критерии, но в примере они есть. Раскомментить, если нужно
union all
SELECT
sr.id,
sr.title,
sr.url,
coalesce(cte.hierarchy || ', ', '') || sr.title
from
cte
inner join
site_resources as sr on
cte.id = sr.parent
--and sr.published = 1 AND sr.template = 10 --Аналогично комменту выше + если надо так отфильтровать только корневые элементы, то вся эта строка тут не нужна
)
SELECT
sr.title as 'Название',
sr.url as 'Урл',
sr.hierarchy as 'Иерархия',
coalesce(meta1.value, sr.title) as 'Title',
coalesce(meta2.value, sr.description) as 'Description'
FROM
cte as sr
LEFT JOIN `site_extrafields` meta1 ON meta1.resid = sr.id AND meta1.fieldid = 4
LEFT JOIN `site_extrafields` meta2 ON meta2.resid = sr.id AND meta2.fieldid = 5;
Notifications permission has been blocked as the user has ignored the permission prompt several times. This can be reset in Page Info which can be accessed by clicking the lock icon next to the URL. See https://www.chromestatus.com/feature/6443143280984064 for more information.
SELECT * ....
EXCEPT
SELECT * ....;
CREATE TABLE `wrdr_promocodes_items` (
`id` INTEGER unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
`code` VARCHAR(100) NOT NULL DEFAULT '',
`discount_amount` INT,
`discount_percent` DECIMAL(3,1),
`num_limit` INT NULL,
`date_limit` DATETIME NULL,
`description` TEXT NOT NULL,
`active` TINYINT unsigned NOT NULL DEFAULT 1
);
$.mask.definitions['h'] = "[12345679]";
$('input[type="tel"]').mask('+7h000000000');
$options[$k][0]=$row['value']
if (!isset($options[$k])) {
$options[$k][] = $row['value'];
}
array()
на []
Создаёт массив с единственным элементом. И присваивает его в$options[$k] = [$row['value']]; // то же самое, что $options[$k] = array($row['value']);
$options[$k]
$arr1 = [ 1, 2, 3 ];
// то же самое, что
$arr1 = array(1, 2, 3);
$arr2 = [
'Habr' => 'QnA',
'Stack' => 'Overflow',
];
// то же самое, что
$arr2 = array(
'Habr' => 'QnA',
'Stack' => 'Overflow',
);
// исходная строка
$options[$k] = [$row['value']];
// означает то же самое, что
$options[$k] = array($row['value']);
// или
$options[$k][] = $row['value'];
$array = array(
"foo" => "bar",
"bar" => "foo",
);
// Использование синтаксиса короткого массива
$array = [
"foo" => "bar",
"bar" => "foo",
];
select le.id, le.locationid, le.eventid,
led.event_date
from location_event le
join location_event_dates led on led.location_event_id = le.id
where led.event_date between :begin_date and :end_date