SELECT `sa_real`.*
FROM (
SELECT DISTINCT `location_id_fk`
FROM `sa_metro_house`
WHERE `metro_id_fk` IN (4,7,6)
) AS `t`
JOIN `sa_real` ON `sa_real`.`house_location_id_fk` = `t`.`location_id_fk`
SELECT *
FROM `sa_real`
WHERE `house_location_id_fk` IN (
SELECT `location_id_fk`
FROM `sa_metro_house`
WHERE `metro_id_fk` IN (4,7,6)
)
int main(void)
{
DDRD = 0xFF;
PORTD = 0x00;
char position = 0;
char step = -1;
while(1) {
PORTD = (1 << position);
if (0 == position || 7 == position) {
step = -step;
}
position += step;
_delay_ms(200);
}
}
SELECT `t`.`id_project`, `p`.`title`, `t`.`task_count`,
`t`.`task_lose`, `t`.`task_active`
FROM (
SELECT `id_project`, COUNT(*) AS `task_count`,
SUM(`status` = '1' AND `deadlines` < :TIME) AS `task_lose`,
SUM(`status` = '1') AS `task_active`
FROM `tasks`
GROUP BY `id_project`
) AS `t`
RIGHT JOIN `projects` AS `p` ON `p`.`id` = `t`.`id_project`
ORDER BY `t`.`task_lose` DESC, `t`.`task_active` DESC,
`t`.`task_count` DESC