1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| String myQuery = "SELECT apsoc.id_society, ";
myQuery += " askpart.id_article,";
myQuery += " soc.tl_name,";
myQuery += " apsoc.bo_choice,";
myQuery += " apsoc.bo_choice_by_vendor";
myQuery += " FROM tbl_ask_price_society AS apsoc ";
myQuery += " INNER JOIN tbl_society AS soc ON soc.id_society = apsoc.id_society";
myQuery += " INNER JOIN tbl_ask_price_article AS askpart ON askpart.id_ask_price_article = apsoc.id_ask_price_article";
myQuery += " INNER JOIN tbl_articles_price_buy AS artpriceb ON artpriceb.id_article = askpart.id_article";
myQuery += " WHERE askpart.id_askprice = ?apsoc.idaskprice AND artpriceb.dt_price = (SELECT MAX(artpb.dt_price) ";
myQuery += " FROM tbl_articles_price_buy as artpb where artpb.id_article = askpart.id_article) ";
myQuery += " INNER JOIN tbl_articles_price_sell AS artprice ON artprice.id_article = askpart.id_article";
myQuery += " WHERE askpart.id_askprice = ?apsoc.idaskprice AND artprice.dt_price = (SELECT MAX(artp2.dt_price) ";
myQuery += " FROM tbl_articles_price_sell as artp2 where artp2.id_article = askpart.id_article) "; |
Partager