mysql - multiplying two columns, displaying as new column in select statement sql -
trying take values 2 columns, multiply them, , display result new column in, in select statement. below got far
select m.item_name, m.price, sum(od.qty) count menu m, order_detail od, sum(m.price * od.qty) tsales m.menuid = od.menuid group m.item_name order count desc limit 10;
i can select statement show new column new values. without last part of select statement this:
i think looking result returned statement this:
select m.item_name , sum(m.price*od.qty) tot_price_times_qty menu m join order_detail od on od.menuid = m.menuid group m.item_name order tot_price_times_qty desc limit 10
but, without sample data or demonstration of expected output, that's guess.
Comments
Post a Comment