- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
$query = "
SELECT `ord`.*,`cus`.`existing_phone_number`,`cus`.`nova_jednotka`,
`cus`.`order_phone`,`cus`.`custom_delivery_date`, `cus`.`delivery_address`,
`cus`.`invoice_address`, `cus`.`invoice_street`, `cus`.`invoice_street_number`,
`cus`.`invoice_city`, `cus`.`invoice_zip`
FROM ".(!empty($_GET["copy_view"]) && $_GET["copy_view"] == 1 ? "`orders`" : "`".$this->table."`")." AS `ord`,
`products`, `navigace`, `customers` AS `cus`
WHERE `ord`.`order_id` = ".$order_id."
AND `ord`.`id_produktu_db` = `products`.`id`
AND `products`.`navigace_polozka_id` = `navigace`.`id`
AND `cus`.`id` = `ord`.`customers_id`
union all
select
null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null,
'', tp.description, tp.product_id, tp.activation_price, tp.activation_price_EUR,
0, tor.pocet_kusu, tp.name, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null, null
from tarifs_prop tp
inner join tarifs_orders tor on tp.id = tor.tarif_prop_id
where tor.order_id = ".$order_id."
union all
select
null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, '', b.description, b.product_id, b.activation_price, b.activation_price_EUR,
0, tor.pocet_kusu, b.name, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null,
null, null, null, null, null, null
from balicky b
inner join tarifs_orders tor on b.id = tor.tarif_balicek_id
where tor.order_id = ".$order_id."
ORDER BY `user_id` desc";
а филе нам кабанам, надо продукты из разных таблиц объединить в одну, ну и фто што таблицы разного размера. Зато когда добавляешь новый столбец в таблицу, нужно вручную считать сколько раз нужно добавить null :D