chiark / gitweb /
SQL queries from ceb, including profitable trade calculator
[ypp-sc-tools.db-live.git] / yarrg / web / best-sell-price
1 <HTML>
2 <HEAD>
3 <TITLE>test pirate page</TITLE>
4 </HEAD>
5 <BODY>
6
7 <html><head><title>Best commod offer</title></head><body>
8 <%perl>
9 my $sth=$dbh->prepare(
10     "SELECT a.commodname,b.price,b.qty,d.stallname,e.islandname
11      FROM commods as a
12      JOIN buy as b on a.commodid=b.commodid
13      JOIN stalls as d on d.stallid=b.stallid
14      JOIN islands as e on e.islandid=d.islandid
15      GROUP BY d.islandid
16      HAVING b.price=MAX(b.price)
17      ");
18
19 $sth->execute();
20 </%perl>
21 <table frame=box rules=all>
22 <tr><td>commod</td><td>price</td><td>qty</td><td>Stall</td><td>island</td></tr>
23 % my @row;
24 % while (@row=$sth->fetchrow_array) {
25 <tr>
26 % foreach my $cell (@row) {
27 <td>
28 <% $cell %>
29 </td>
30 % }
31 </tr>
32 % }
33 </table>
34
35 </BODY>
36 </HTML>
37
38 <%init>
39 use CommodsWeb;
40 my $dbh= dbw_connect('Midnight');
41 </%init>