Revision 88153712
Von Moritz Bunkus vor fast 18 Jahren hinzugefügt
SL/AM.pm | ||
---|---|---|
997 | 997 |
# connect to database |
998 | 998 |
my $dbh = $form->dbconnect($myconfig); |
999 | 999 |
|
1000 |
my $query = qq|SELECT id, description, inventory_accno_id, (select accno from chart where id=inventory_accno_id) as inventory_accno, income_accno_id_0, (select accno from chart where id=income_accno_id_0) as income_accno_0, expense_accno_id_0, (select accno from chart where id=expense_accno_id_0) as expense_accno_0, income_accno_id_1, (select accno from chart where id=income_accno_id_1) as income_accno_1, expense_accno_id_1, (select accno from chart where id=expense_accno_id_1) as expense_accno_1, income_accno_id_2, (select accno from chart where id=income_accno_id_2) as income_accno_2, expense_accno_id_2, (select accno from chart where id=expense_accno_id_2) as expense_accno_2, income_accno_id_3, (select accno from chart where id=income_accno_id_3) as income_accno_3, expense_accno_id_3, (select accno from chart where id=expense_accno_id_3) as expense_accno_3 |
|
1001 |
FROM buchungsgruppen |
|
1002 |
ORDER BY id|; |
|
1000 |
my $query = qq|SELECT id, description, |
|
1001 |
inventory_accno_id, |
|
1002 |
(SELECT accno FROM chart WHERE id = inventory_accno_id) AS inventory_accno, |
|
1003 |
income_accno_id_0, |
|
1004 |
(SELECT accno FROM chart WHERE id = income_accno_id_0) AS income_accno_0, |
|
1005 |
expense_accno_id_0, |
|
1006 |
(SELECT accno FROM chart WHERE id = expense_accno_id_0) AS expense_accno_0, |
|
1007 |
income_accno_id_1, |
|
1008 |
(SELECT accno FROM chart WHERE id = income_accno_id_1) AS income_accno_1, |
|
1009 |
expense_accno_id_1, |
|
1010 |
(SELECT accno FROM chart WHERE id = expense_accno_id_1) AS expense_accno_1, |
|
1011 |
income_accno_id_2, |
|
1012 |
(SELECT accno FROM chart WHERE id = income_accno_id_2) AS income_accno_2, |
|
1013 |
expense_accno_id_2, |
|
1014 |
(select accno FROM chart WHERE id = expense_accno_id_2) AS expense_accno_2, |
|
1015 |
income_accno_id_3, |
|
1016 |
(SELECT accno FROM chart WHERE id = income_accno_id_3) AS income_accno_3, |
|
1017 |
expense_accno_id_3, |
|
1018 |
(SELECT accno FROM chart WHERE id = expense_accno_id_3) AS expense_accno_3 |
|
1019 |
FROM buchungsgruppen |
|
1020 |
ORDER BY id|; |
|
1003 | 1021 |
|
1004 | 1022 |
$sth = $dbh->prepare($query); |
1005 | 1023 |
$sth->execute || $form->dberror($query); |
1006 | 1024 |
|
1025 |
$form->{ALL} = []; |
|
1007 | 1026 |
while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { |
1008 | 1027 |
push @{ $form->{ALL} }, $ref; |
1009 | 1028 |
} |
Auch abrufbar als: Unified diff
Weitere Abfragen umformatiert.