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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is an inner join?

709


What is database replication? What are the different types of replication you can set up in sql server?

667


What is the difference between ROW_NUMBER and Ranking function in SQL SERVER?

833


How to Insert multiple rows with a single insert statement?

745


How do I open a .db file?

732






How do you rename a table in sql server?

644


Explain what stored procedure sp_replcounters is used for? : sql server replication

1236


What do you understand by hotfixes and patches in sql server?

690


What are joins in sql and what are the different types of joins?

713


Explain can you implement data mining in ssrs?

122


whats the maximum size of view state??

1905


Explain syntax for viewing, dropping and disabling triggers?

693


What is key set driven?

705


What the class forname () does?

709


How to see the event list of an existing trigger using sys.trigger_events?

771