Revision c3500451
Von G. Richardson vor mehr als 5 Jahren hinzugefügt
SL/AM.pm | ||
---|---|---|
1024 | 1024 |
t.taxkey, |
1025 | 1025 |
t.taxdescription, |
1026 | 1026 |
round(t.rate * 100, 2) AS rate, |
1027 |
(SELECT accno FROM chart WHERE id = chart_id) AS taxnumber,
|
|
1028 |
(SELECT description FROM chart WHERE id = chart_id) AS account_description,
|
|
1029 |
(SELECT accno FROM chart WHERE id = skonto_sales_chart_id) AS skonto_chart_accno,
|
|
1030 |
(SELECT description FROM chart WHERE id = skonto_sales_chart_id) AS skonto_chart_description,
|
|
1031 |
(SELECT accno FROM chart WHERE id = skonto_purchase_chart_id) AS skonto_chart_purchase_accno,
|
|
1032 |
(SELECT description FROM chart WHERE id = skonto_purchase_chart_id) AS skonto_chart_purchase_description
|
|
1027 |
tc.accno AS taxnumber,
|
|
1028 |
tc.description AS account_description,
|
|
1029 |
ssc.accno AS skonto_chart_accno,
|
|
1030 |
ssc.description AS skonto_chart_description,
|
|
1031 |
spc.accno AS skonto_chart_purchase_accno,
|
|
1032 |
spc.description AS skonto_chart_purchase_description
|
|
1033 | 1033 |
FROM tax t |
1034 |
LEFT JOIN chart tc ON (tc.id = t.chart_id) |
|
1035 |
LEFT JOIN chart ssc ON (ssc.id = t.skonto_sales_chart_id) |
|
1036 |
LEFT JOIN chart spc ON (spc.id = t.skonto_purchase_chart_id) |
|
1034 | 1037 |
ORDER BY taxkey, rate|; |
1035 | 1038 |
|
1036 | 1039 |
my $sth = $dbh->prepare($query); |
Auch abrufbar als: Unified diff
Refactoring sql-Abfrage für Steuertabelle
statt 2 subselects pro Automatik- und Skontokonto, jeweils ein Join, um
die Kontonummer und Kontenbeschreibung direkt auszulesen.