console.log(new Date(1436022000*1000))
> Date 2015-07-04T15:00:00.000Z
SELECT `cat`.`id`, `cat`.`name`
FROM `category` AS `cat`
LEFT JOIN (
SELECT DISTINCT `parent_category_id` AS `parent`
FROM `category`
) AS `sub` ON `cat`.`id` = `sub`.`parent`
WHERE `sub`.`parent` IS NULL
SELECT `t1`.`name`, `t1`.`val`, `t1`.`date`
FROM `table` AS `t1`
JOIN (
SELECT `name`, MAX(`date`) AS `date`
FROM `table`
GROUP BY `name`
) AS `t2` ON `t2`.`name` = `t1`.`name` AND `t2`.`date` = `t1`.`date`
Received: by 10.194.78.40 with SMTP id y8csp1449227wjw;
Sat, 20 Jun 2015 22:23:48 -0700 (PDT)
Received: from smart1.russianpost.ru (smart1.russianpost.ru. [91.215.36.115])
by mx.google.com with ESMTP id wd2si13339101lbb.123.2015.06.20.22.23.47
for <***@gmail.com>;
Sat, 20 Jun 2015 22:23:48 -0700 (PDT)
Received: from [10.6.40.76] (HELO VEGA)
by smart1.russianpost.ru (CommuniGate Pro SMTP 4.2.10)
with ESMTP id 50561940 for ***@gmail.com; Sun, 21 Jun 2015 08:23:28 +0300
From: webmaster@russianpost.ru
void divide(int num, int div) {
int quot, rest, pos;
int positions[1000];
char out[1024];
printf("%d / %d = ", num, div);
for (pos = 0; pos < 1000; pos++)
positions[pos] = -1;
quot = num / div;
rest = num % div;
pos = sprintf(out, "%d", quot);
if (rest)
out[pos++] = '.';
while (positions[rest] == -1 && rest) {
positions[rest] = pos;
num = rest * 10;
quot = num / div;
rest = num % div;
out[pos++] = quot+'0';
}
out[pos] = 0;
if (rest == 0)
printf("%s\n", out);
else
printf("%.*s(%s)\n", positions[rest], out, out+positions[rest]);
}
SELECT `p`.`title`, `p`.`text`, `t`.`tag`
FROM (
SELECT `title` FROM `posts` WHERE ... LIMIT 10
) AS `p`
LEFT JOIN `post_tag` AS `pt` ON `pt`.`post_id` = `p`.`id`
LEFT JOIN `tags` AS `t` ON `t`.`id` = `pt`.`tag_id`
ORDER BY `p`.`title`, `t`.`tag`
SELECT `doc`.`id`
FROM `doc`
JOIN (
SELECT `doc_id`
FROM `value_attribute`
WHERE `attribute_id` = :attr1_id AND `value_varchar` LIKE :attr1_val
) AS `a1` ON `a1`.`doc_id` = `doc`.`id`
JOIN (
SELECT `doc_id`
FROM `value_attribute`
WHERE `attribute_id` = :attr2_id AND `value_int` = :attr2_val
) AS `a2` ON `a2`.`doc_id` = `doc`.`id`
...