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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Give an example of SQL injection attack ?

576


What is the command used to recompile the stored procedure at run time?

631


How to execute a sql statement using odbc_exec()?

576


what is difference between view and Dip.

2013


How to backup SQL Server Reporting Services ?

103






What do you understand by sql server agent?

540


What is bit data type?

636


What is data source view or dsv? : sql server analysis services, ssas

563


do views contain data ?

594


What is the tcp/ip port on which sql server runs?

574


How many types of triggers are there?

579


How can you stop stored procedures from recompiling?

496


You are doing log shipping due to some reasons it is failing. How you will proceed from there

1555


What is xml datatype?

672


What is the difference between a primary key and a unique key? Are they the same?

559