- 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
SELECT ct.com_id, cdt.com_name, ct.tax_id, pt.tax_name, tt.date FROM com_table AS ct LEFT OUTER
JOIN com_des_table AS cdt ON cdt.id = ct.com_id LEFT OUTER JOIN payments_table AS pt ON pt.id =
ct.tax_id LEFT OUTER JOIN tax_table AS tt ON tt.tax_id = ct.tax_id WHERE ct.tax_id LIKE '001%' and
ct.com_id = '1' UNION SELECT ct.com_id, cdt.com_name, ct.tax_id, rt.tax_name, tt.date FROM com_table
AS ct LEFT OUTER JOIN com_des_table AS cdt ON cdt.id = ct.com_id LEFT OUTER JOIN reports_table AS
rt ON rt.id = ct.tax_id LEFT OUTER JOIN tax_table AS tt ON tt.tax_id = ct.tax_id WHERE ct.tax_id LIKE
'002%' and ct.com_id = '1' UNION SELECT ct.com_id, cdt.com_name, ct.tax_id, pt.tax_name, tt.date FROM
com_table AS ct LEFT OUTER JOIN com_des_table AS cdt ON cdt.id = ct.com_id LEFT OUTER JOIN
payments_table AS pt ON pt.id = ct.tax_id LEFT OUTER JOIN tax_table AS tt ON tt.tax_id = ct.tax_id
WHERE ct.tax_id LIKE '001%' and ct.com_id = '0' UNION SELECT ct.com_id, cdt.com_name, ct.tax_id,
rt.tax_name, tt.date FROM com_table AS ct LEFT OUTER JOIN com_des_table AS cdt ON cdt.id = ct.com_id
LEFT OUTER JOIN reports_table AS rt ON rt.id = ct.tax_id LEFT OUTER JOIN tax_table AS tt ON tt.tax_id =
ct.tax_id WHERE ct.tax_id LIKE '002%' and ct.com_id = '0' UNION SELECT ct.com_id, cdt.com_name,
ct.tax_id, pt.tax_name, tt.date FROM com_table AS ct LEFT OUTER JOIN com_des_table AS cdt ON cdt.id =
ct.com_id LEFT OUTER JOIN payments_table AS pt ON pt.id = ct.tax_id LEFT OUTER JOIN tax_table AS tt
ON tt.tax_id = ct.tax_id WHERE ct.tax_id LIKE '001%' and ct.com_id = '2' UNION SELECT ct.com_id,
cdt.com_name, ct.tax_id, rt.tax_name, tt.date FROM com_table AS ct LEFT OUTER JOIN com_des_table AS
cdt ON cdt.id = ct.com_id LEFT OUTER JOIN reports_table AS rt ON rt.id = ct.tax_id LEFT OUTER JOIN
tax_table AS tt ON tt.tax_id = ct.tax_id WHERE ct.tax_id LIKE '002%' and ct.com_id = '2' UNION SELECT
ct.com_id, cdt.com_name, ct.tax_id, pt.tax_name, tt.date FROM com_table AS ct LEFT OUTER JOIN
com_des_table AS cdt ON cdt.id = ct.com_id LEFT OUTER JOIN payments_table AS pt ON pt.id = ct.tax_id
LEFT OUTER JOIN tax_table AS tt ON tt.tax_id = ct.tax_id WHERE ct.tax_id LIKE '001%' and ct.com_id = '3'
UNION SELECT ct.com_id, cdt.com_name, ct.tax_id, rt.tax_name, tt.date FROM com_table AS ct LEFT
OUTER JOIN com_des_table AS cdt ON cdt.id = ct.com_id LEFT OUTER JOIN reports_table AS rt ON rt.id =
ct.tax_id LEFT OUTER JOIN tax_table AS tt ON tt.tax_id = ct.tax_id WHERE ct.tax_id LIKE '002%' and
ct.com_id = '3';
Не помню, что именно. Вырыл в старом логе. К сожалению из-за местных ограничений по длине кода не удалось выложить подобные портянки длинной в 10 тыщ символов.