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

How do you run a trace?

610


What are commit and rollback in sql?

658


We are updating a field in sql and alter the row also.after giving the commit command the system is crashed.what will happen to the commands given,whether it will update and alter the table or not?

993


How do I view a trc file?

590


What is DCL?

676






Can you get second highest salary from the table?

635


Explain the collation?

728


How to use clusters?

618


What are user-defined functions (udfs) in sql server?

648


What type of locking occurs during the snapshot generation? : sql server replication

976


Explain how does the report manager work in ssrs?

592


Explain where clause?

626


What is cursors? And what are the different types of cursor?

649


What is RAID? What are the different types of RAID configurations?

699


What is the difference between NOROW and LOCKROW?

2363