DO UPDATE SET ... WHERE condition
melkij=> create temp table foo (item int primary key, d date, price numeric);
CREATE TABLE
melkij=> insert into foo values (1, '2021-07-30', 100) on conflict (item) do update set price = excluded.price, d = excluded.d where excluded.d > foo.d;
INSERT 0 1
melkij=> table foo;
item | d | price
------+------------+-------
1 | 2021-07-30 | 100
(1 строка)
melkij=> insert into foo values (1, '2021-08-01', 110) on conflict (item) do update set price = excluded.price, d = excluded.d where excluded.d > foo.d;
INSERT 0 1
melkij=> table foo;
item | d | price
------+------------+-------
1 | 2021-08-01 | 110
(1 строка)
melkij=> insert into foo values (1, '2021-07-20', 80) on conflict (item) do update set price = excluded.price, d = excluded.d where excluded.d > foo.d;
INSERT 0 0
melkij=> table foo;
item | d | price
------+------------+-------
1 | 2021-08-01 | 110
(1 строка)
[[:<:]], [[:>:]]
These markers stand for word boundaries.
The Spencer library supports word-beginning and word-end boundary markers ([[:<:]] and [[:>:]] notation). ICU does not. For ICU, you can use \b to match word boundaries; double the backslash because MySQL interprets it as the escape character within strings.
fs.writeFile(file, data[, options], callback)#
History:
- file
<string> | <Buffer> | <URL> | <integer>
filename or file descriptor- data
<string> | <Buffer> | <TypedArray> | <DataView> | <Object>
- options
<Object> | <string>
- encoding
<string> | <null>
Default: 'utf8'- mode
<integer>
Default: 0o666- flag
<string>
See support of file system flags. Default: 'w'.- signal
<AbortSignal>
allows aborting an in-progress writeFile- callback
<Function>
- err
<Error> | <AggregateError>
When file is a filename, asynchronously writes data to the file, replacing the file if it already exists. data can be a string or a buffer.
When file is a file descriptor, the behavior is similar to calling fs.write() directly (which is recommended). See the notes below on using a file descriptor.
The encoding option is ignored if data is a buffer.
If data is a plain object, it must have an own (not inherited) toString function property.
...
fs.write
). После этого нужные пункты оглавления подсветятся желтым и вы легко найдете нужный. with recursive cat as (
select id, id top from landcategory where parent_id is null
union
select lc.id, top from landcategory lc join cat on (cat.id = lc.parent_id)
)
select lc.*, childs from landcategory lc join (
select top, array_agg(id) childs from cat
group by 1
) t on (t.top = lc.id)
INSERT INTO table
SELECT
seq, NOW(), NOW(), 1, 1, seq
FROM seq_1_to_9999
Ну или, может, какие-то другие варианты есть?
foreach ($arBlocks as $IBLOCK_ID) {
$multiplier = getPriceMultiplierByBlock($IBLOCK_ID);
$newPrice = $price * $multiplier;
// сохраняйте
}
function getPriceMultiplierByBlock($blockId) {
$multipliers = [
2 => 1.30,
8 => 1.30,
9 => 1.20,
43 => 1.25,
44 => 1.20,
45 => 1.10,
99 => 1.10,
// ...
];
return isset($multipliers[$blockId])
? $multipliers[$blockId]
: 1; // если множитель не указан - единица
}