Table - Products has number of products as below
Productid ProductName
1
iPhone
2
iPad
3
BlackBerry
Table - SalesPersonProduct has the
below records
Salespersonid
productid
S1
1
S1
2
S1
3
S2
1
S3
2
Write a SQL query that returns the number of sales for each
product
Answers were Sorted based on User's Feedback
Answer / subbareddy.l
Hi,
This query will give us number of sales product wise
select SPP.Productid,COUNT(SPP.Productid)CC from
SalesPersonProduct SPP inner join products P
ON SPP.Productid=P.Productid
group by SPP.Productid
Thanks,
subbareddy.l
Is This Answer Correct ? | 5 Yes | 0 No |
Answer / madhu sudhan g
Hiii
try this query you will get the answer
select count(1) as SalesCount,P.Product from Products P
INNER JOIN SalesPersonProduct S ON S.Id=p.Id group by P.Product
Is This Answer Correct ? | 2 Yes | 0 No |
What should we do to copy the tables, schema and views from one SQL Server to another?
What is buffer cash and log cache in sql server?
What new changes are being made in SQL Server?
What is the recovery model? List the types of recovery model available in sql server?
two tables are there.1st table EMP has two columns ID and name and contains data 1,A 2,B 3,C 2nd table EmpSal has 2 columns ID and Salary Contains data -1,1000 2,5000 3,3000 Find name of employee having maximum salary ?
What is the contrast between sql and mysql?
What is use of except clause?
What is difference between views and stored procedures?
How to concatenate two binary strings together?
What is subquery in sql?
when inserting to a table how many rows will be effected using triggers
How can we determine what objects a user-defined function depends upon?