Revision af6756b8
Von Moritz Bunkus vor etwa 11 Jahren hinzugefügt
SL/AM.pm | ||
---|---|---|
1900 | 1900 |
|
1901 | 1901 |
map { $form->{$_} = $ref->{$_} } keys %{ $ref }; |
1902 | 1902 |
|
1903 |
$query = qq|SELECT b.*, EXISTS |
|
1904 |
(SELECT i.warehouse_id, p.warehouse_id |
|
1905 |
FROM inventory i, parts p |
|
1906 |
WHERE i.bin_id = b.id |
|
1907 |
OR p.bin_id = b.id |
|
1908 |
LIMIT 1) |
|
1909 |
AS in_use |
|
1910 |
FROM bin b |
|
1911 |
WHERE b.warehouse_id = ?|; |
|
1903 |
$query = <<SQL; |
|
1904 |
SELECT b.*, |
|
1905 |
( EXISTS(SELECT i.bin_id FROM inventory i WHERE i.bin_id = b.id LIMIT 1) |
|
1906 |
OR EXISTS(SELECT p.bin_id FROM parts p WHERE p.bin_id = b.id LIMIT 1)) |
|
1907 |
AS in_use |
|
1908 |
FROM bin b |
|
1909 |
WHERE b.warehouse_id = ? |
|
1910 |
SQL |
|
1912 | 1911 |
|
1913 | 1912 |
$form->{BINS} = selectall_hashref_query($form, $dbh, $query, conv_i($form->{id})); |
1914 | 1913 |
|
Auch abrufbar als: Unified diff
AM.pm::get_warehouse: keinen teuren Cross Join
Ein Cross Join wird nicht benötigt, weil nur die Existenz einer Zeile
in mind. einer der beiden relevanten Tabellen interessant ist. Das
auch entsprechend coden.
Fixt #2359.