Home > database >  Dear bosses, at leisure time to give directions
Dear bosses, at leisure time to give directions

Time:09-24

CodePudding user response:


The select br. Branch_name, sum (so. Order_price) total
The from sellorders so, storehouse sh, branch br
Where so. Store_id=sh. Store_id
And sh. Branch_id=br. Branch_id
So the delivery_state=15
And so the order_time & gt;=to_date (' 20150301 ', 'YYYYMMDD')
And so the order_time & lt; To_date (' 20150401 ', 'YYYYMMDD')
And so the order_price & gt; 500
Group by br. Branch_name;

CodePudding user response:

The total sum (so order_price/10000)

CodePudding user response:

The sum (so. Order_price)/10000 total

CodePudding user response:

The SELECT a. ranch_id, round (SUM (c.o rder_price)/10000, 2)
The FROM branch a, storehouse b, sellorders c
WHERE a. ranch_id=b.b ranch_id
AND b.s tore_id c.s. tore_id=
AND c.o rder_time & gt;=to_date (' 20150301 ', 'yyyymmdd')
AND c.o rder_time & lt; To_date (' 20150401 ', 'yyyymmdd')
AND c.d elivery_state=15
AND c.o rder_price & gt; 500
GROUP BY a. ranch_id

- perhaps that's it

CodePudding user response:

A warehouse have two branches share, then how do you determine the amount of the order of the warehouse is which company, order list should be less a branch id field.

The select mount ranch_name, concat (round (a.t otal/10000, 2), 'm') from

(select store_id, sum (order_price) as the total from sellorders
Where delivery_state=15
And to_char (order_time, 'yyyy - mm)=' 2015-03 '
Group by store_id
Having the sum (order_price) & gt; 500) a
Inner join storehouse b
On a.s tore_id=b.s tore_id
Left the join branch c
On b.b ranch_id=mount ranch_id
  • Related