1) Print the description and total qty sold for each product.
select s.product_no,p.description, sum(s.qty_ordered) from sales_order_details s,product_master p
where p.product_no=s.product_no
group by s.product_no,p.description;
2) Find the value of each product sold.
select s.product_no,p.description,sum(s.qty_disp*s.product_rate) "Sales Per Product" from
sales_order_details s,product_master p where p.product_no=s.product_no
group by s.product_no,p.description;
select c.client_no,c.name,avg(s.qty_disp) "Avg. Sales" from sales_order_details s ,sales_order so,client_master c
where c.client_no=so.client_no and so.s_order_no=s.s_order_no
group by c.client_no,c.name having max(s.qty_ordered*s.product_rate)>15000;
4) find out the total sales amount receivable for the month of jan.it will be the sum total of all the billed orders for the month.
select s.s_order_no,s.s_order_date,sum(so.qty_ordered*so.product_rate)"Order Billed",sum(so.qty_disp*so.product_rate) "Total Amount" from sales_order s, sales_order_details so
where so.s_order_no=s.s_order_no and s.billed_yn='Y' and to_char(s_order_date,'mon')='jan'
group by s.s_order_no,s.s_order_date;
select p.description||' Worth Rs'||sum(d.qty_disp*d.product_rate) from product_master p, sales_order_details d
where p.product_no=d.product_no group by p.description;
select p.description||' Worth Rs'||sum(d.qty_disp*d.product_rate)||' was ordered in the month of'||to_char(s_order_date,'month')"Description Total amount Month" from product_master p, sales_order_details d,sales_order s
where p.product_no=d.product_no and s.s_order_no=d.s_order_no group by p.description,s.s_order_date;
Give me answer for
ReplyDeleteDisplay the order number and day on which clients placed their order.
Select c.client_no,s.s_order_no,s.s_order_date from client c, sales_order s where c.client_no=s.client_no group by c.client_no,s.s_order_no;
ReplyDelete