24/05/09 15:13
yoghi87
salve ho 2 fornitori che mi offrono lo stesso tipo di lamiera e io voglio restituire il nome del fornitore più conveniente tenendo conto del prezzo e sconto. Queste sono le tabelle prese in considerazione:
mysql> select * from Fornitore; +-------------+--------------+ | Partita_IVA | Nome | +-------------+--------------+ | 12300000000 | Invenzione 1 | | 12340000000 | Invenzione 2 | | 12345000000 | Invenzione 3 | | 12345600000 | Invenzione 4 | | 12345670000 | Invenzione 5 | | 87878787878 | Invezione10 | +-------------+--------------+
mysql> select * from Preventivo; +---------------+----------+--------+--------+------------+------------+ | Id_preventivo | Quantità | Prezzo | Sconto | Data | Id_lamiera | +---------------+----------+--------+--------+------------+------------+ | 001/9 | 50 | 3.00 | 0.20 | 2009-08-02 | 0001 | | 001/9 | 75 | 2.00 | 0.20 | 2009-08-02 | 0002 | | 001/9 | 40 | 2.00 | 0.20 | 2009-08-02 | 0003 | | 002/9 | 30 | 3.00 | 0.20 | 2009-08-10 | 0004 | | 002/9 | 80 | 2.00 | 0.20 | 2009-08-10 | 0005 | | 003/9 | 40 | 1.50 | 0.25 | 2009-10-15 | 0001 | +---------------+----------+--------+--------+------------+------------+
mysql> select * from Elabora; +-------------+---------------+------------+ | Partita_IVA | Id_preventivo | Data | +-------------+---------------+------------+ | 12300000000 | 001/9 | 2009-06-30 | | 12340000000 | 002/9 | 2009-07-05 | | 87878787878 | 003/9 | 2009-05-24 | +-------------+---------------+------------+
aaa