SELECT `t1`.`id_house`, `t1`.`znach`, `t2`.`znach`, `t3`.`znach`, `t4`.`znach`
FROM (
SELECT `id_house`, `znach` FROM `table` WHERE `property_id` = :property1
) AS `t1`
JOIN (
SELECT `id_house`, `znach` FROM `table` WHERE `property_id` = :property2
) AS `t2` ON `t2`.`id_house` = `t1`.`id_house`
JOIN (
SELECT `id_house`, `znach` FROM `table` WHERE `property_id` = :property3
) AS `t3` ON `t3`.`id_house` = `t1`.`id_house`
JOIN (
SELECT `id_house`, `znach` FROM `table` WHERE `property_id` = :property4
) AS `t4` ON `t4`.`id_house` = `t1`.`id_house`
SELECT `o`.`title`, `f`.`value` AS `filling`, `t`.`value` AS `taste`
FROM `orders` AS `o`
LEFT JOIN (
SELECT `of`.`id_order` AS `id_order`, `of`.`value` AS `value`
FROM `order_fields` AS `of`
JOIN `fields` AS `f` ON `f`.`name` = 'Начинка' AND `f`.`id` = `of`.`id_field`
) AS `f` ON `f`.`id_order` = `o`.`id`
LEFT JOIN (
SELECT `of`.`id_order` AS `id_order`, `of`.`value` AS `value`
FROM `order_fields` AS `of`
JOIN `fields` AS `f` ON `f`.`name` = 'Вкус' AND `f`.`id` = `of`.`id_field`
) AS `t` ON `t`.`id_order` = `o`.`id`
#include <string.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
unsigned char *text, *key;
unsigned char shift, rightNumber;
for (text = argv[1], key = argv[2]; *text; text++, key++) {
if (0 == *key)
key = argv[2];
if (*text >= 'A' && *text <= 'Z') {
shift = *key - 'A';
rightNumber = *text + shift;
if (rightNumber > 'Z')
rightNumber -= ('Z' - 'A');
printf(""%c + %c '%.3d' == "%c\n", *text, *key, shift, rightNumber);
}
}
SELECT `g`.`id`, `g`.`name`, `g`.`description`, `g`.`price`, `i`.`images`
FROM `goods` AS `g`
LEFT JOIN (
SELECT `good_id`, GROUP_CONCAT(`link` SEPARATOR ',') AS `images`
FROM `images`
GROUP BY `good_id`
) AS `i` ON `i`.`good_id` = `g`.`id`
WHERE `g`.`id_category` = :category
ORDER BY `g`.`id` DESC;
SELECT `a`.`name`, IFNULL(`c`.`count`, 0)
FROM `author_user` AS `au`
JOIN `authors` AS `a` ON `au`.`user` = :user AND `a`.`id` = `au`.`author_id`
LEFT JOIN (
SELECT `p`.`author_id`, COUNT(*) AS `count`
FROM `posts` AS `p`
LEFT JOIN `post_user` AS `pu` ON `pu`.`user_id` = :user AND `pu`.`post_id` = `p`.`id`
WHERE `pu`.`post_id` IS NULL
GROUP BY `p`.`author_id`
) AS `c` ON `c`.`author_id` = `au`.`author_id`