UNION (SELECT 0 as Orders, 0 as Hours)
UNION (SELECT 0 as Orders, 1 as Hours)
...
UNION (SELECT 0 as Orders, 23 as Hours)
Не знаю, как именно это будет записываться в MSSQL UPDATE `table` SET `proc`=`proc`+1 WHERE ...
INSERT INTO `table` (`id`, `proc`)
VALUES ($id1, $proc1), ($id2, $proc2), ...
ON DUPLICATE KEY UPDATE SET `proc` = VALUES(`proc`)
UPDATE `table` SET `proc` = $proc1 WHERE `id` = $id1
UPDATE `table` SET `proc` = $proc2 WHERE `id` = $id2
SELECT `track`, `phone`, `status`,
to_days(IFNULL(`date_finish`, curdate())) - to_days(`date_add`) as `diff`
FROM `track_tabl` WHERE `id_user` = '$id_user'
SELECT `track`, `phone`, `status`,
to_days(IF(`date_finish` = '', curdate(), `date_finish`)) - to_days(`date_add`) as `diff`
FROM `track_tabl` WHERE `id_user` = '$id_user'
Set(CDR(userfield)=имя_файла)
<table>
<thead>
<tr><th>Трек-код<th>Телефон<th>Статус<th>Время в пути
<tbody>
<tr><td>R417...<td>+7900...<td>Прибыло<td>11 дней
<tr><td>...<td>...<td>...<td>...
...
</table>