1. Two tables Product(pid,pname), sales(pid,sales,orderdate)
now select pid,sum(sales) with pid& date wise
Ans:
select p.pid,SUM(s.sales),s.orderdate from product p
inner join Sales s
on p.PID=s.pid
group by p.pid,s.orderdate
order by p.pid
2.Update a table based on another table
update tab_a
set tab_a.loc=tab_loc
from tabeleA tab_a inner join tableB tab_b
on tab_a.id=tab_b.id
now select pid,sum(sales) with pid& date wise
Ans:
select p.pid,SUM(s.sales),s.orderdate from product p
inner join Sales s
on p.PID=s.pid
group by p.pid,s.orderdate
order by p.pid
2.Update a table based on another table
update tab_a
set tab_a.loc=tab_loc
from tabeleA tab_a inner join tableB tab_b
on tab_a.id=tab_b.id
No comments:
Post a Comment