Profitable trades
<%perl>
my $sth=$dbh->prepare(
"SELECT commods.commodname,
sell_islands.islandname,sell_stalls.stallname,sell.price,sell.qty,
buy_islands.islandname,buy_stalls.stallname,buy.price,buy.qty
FROM commods
JOIN buy on commods.commodid=buy.commodid
JOIN sell on commods.commodid=sell.commodid
JOIN islands as buy_islands on buy.islandid = buy_islands.islandid
JOIN stalls as buy_stalls on buy.stallid = buy_stalls.stallid
JOIN islands as sell_islands on sell.islandid = sell_islands.islandid
JOIN stalls as sell_stalls on sell.stallid = sell_stalls.stallid
WHERE buy.islandid like '36' and sell.islandid like '5'
and buy.price > sell.price
");
$sth->execute();
%perl>
commod | buy island | buy stall | buy price | buy quantity | sell island | sell stall | sell price | sell qty |
% my @row;
% while (@row=$sth->fetchrow_array) {
% foreach my $cell (@row) {
<% $cell %>
|
% }
% }
<%init>
use CommodsWeb;
my $dbh= dbw_connect('Midnight');
%init>