Revision b49779f0
Von Moritz Bunkus vor mehr als 17 Jahren hinzugefügt
SL/Form.pm | ||
---|---|---|
1944 | 1944 |
} |
1945 | 1945 |
|
1946 | 1946 |
# now get the account numbers |
1947 |
$query = qq|SELECT c.accno, c.description, c.link, c.taxkey_id, tk.tax_id |
|
1948 |
FROM chart c, taxkeys tk |
|
1949 |
WHERE c.link LIKE ? |
|
1950 |
AND ( tk.chart_id = c.id OR c.link LIKE '%_tax%') |
|
1951 |
AND (NOT tk.chart_id = c.id OR NOT c.link LIKE '%_tax%') |
|
1952 |
AND (tk.id = (SELECT id FROM taxkeys WHERE taxkeys.chart_id = c.id AND startdate <= $transdate ORDER BY startdate DESC LIMIT 1) |
|
1953 |
OR c.link LIKE '%_tax%') |
|
1954 |
ORDER BY c.accno|; |
|
1947 |
$query = qq|SELECT c.accno, c.description, c.link, c.taxkey_id, tk.tax_id |
|
1948 |
FROM chart c |
|
1949 |
LEFT JOIN taxkeys tk ON (tk.chart_id = c.id) |
|
1950 |
WHERE c.link LIKE ? |
|
1951 |
AND (tk.id = (SELECT id FROM taxkeys WHERE taxkeys.chart_id = c.id AND startdate <= $transdate ORDER BY startdate DESC LIMIT 1) |
|
1952 |
OR c.link LIKE '%_tax%') |
|
1953 |
ORDER BY c.accno|; |
|
1955 | 1954 |
|
1956 | 1955 |
$sth = $dbh->prepare($query); |
1957 | 1956 |
do_statement($self, $sth, $query, "%$module%"); |
Auch abrufbar als: Unified diff
Query durch LEFT JOIN vereinfacht und die Ergebnisanzahl deutlich reduziert.