ALTER TABLE table AUTO_INCREMENT = 100
WITH discussion_count AS (
SELECT count(*) cnt FROM discussion WHERE author_id=?
),
discussion_messages_count AS (
SELECT count(*) cnt FROM discussion_messages WHERE author_id=?
)
SELECT
p.name, dc.cnt discussions, dmc.cnt dcount
FROM people p, discussion_count dc, discussion_messages_count dmc
WHERE p.id=?
count=100; i=0; find . -maxdepth 1 -type f | while read f; do n=$[i/c+1]; i=$[i+1]; mkdir -p "$n" && mv "$f" "$n/$f"; done
function format($size,$prefix=0){
if (is_numeric($size) && $size>=1000 && $prefix<8) {
$size = format(floor($size/1000),$prefix+1);
return $size;
} else {
$prefixName = ["B","KB","MB","GB","TB","PB","EB","ZB","YB"];
return $size . $prefixName[$prefix];
}
}
SELECT rate, type, route_id, weight, volume FROM (
SELECT rate, type, route_id, weight, volume,
CASE WHEN rs.volume >= 300 THEN
row_number() OVER (PARTITION BY route_id ORDER BY volume)
ELSE null END r_volume,
CASE WHEN rs.weight >= 50000 THEN
row_number() OVER (PARTITION BY route_id ORDER BY weight)
ELSE null END r_weight
FROM test_rates rs
WHERE
rs.dt_del IS NULL
AND (rs.volume >= 300 OR rs.weight >= 50000)
) WHERE r_volume=1 OR r_weight=1
ORDER BY rate DESC
LIMIT 1
SELECT * FROM (
SELECT
table.*,
CASE
WHEN type='video' THEN row_number() OVER (PARTITION BY type ORDER BY create_date) *2
ELSE row_number() OVER (PARTITION BY type ORDER BY create_date) +1
END ord
FROM table
) result ORDER BY ord, type DESC
[Trigger]
Operation = Upgrade
Operation = Remove
Type = Package
Target = linux
[Action]
Depends = bash
Depends = find
When = PreTransaction
Exec = /usr/bin/bash -c "/usr/bin/find . -type l -exec test ! -e {} \; -delete; /usr/bin/mkdir -p /tmp/save-running-kernel-modules && /usr/bin/cp -a /usr/lib/modules/$(uname -r) /tmp/save-running-kernel-modules"
[Trigger]
Operation = Upgrade
Operation = Remove
Type = Package
Target = linux
[Action]
Depends = bash
When = PostTransaction
Exec = /usr/bin/bash -c "/usr/bin/ln -s /tmp/save-running-kernel-modules/$(uname -r) /usr/lib/modules/$(uname -r)"