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 types of integrity are enforced by a foreign-key constraint
What is Index ? Explain its Types?
How to create indexed view?
What is your recommendation for a query running very slow? : sql server database administration
How to convert numeric expression data types by assignment operations?
What is the Disadvantage of indexed sequential file.
Explain activity monitors
Explain steps of normalization?
What are the all different types of Joins in SQL Server 2000, Anybody can explain each join with definition..Thanks in advance....
9 Answers DELL, i Tech, Infosys, Siemens, TCS,
How to divide query output into multiple groups with the group by clause in ms sql server?
How do you delete a trigger?
what is differencial backup?how to work?Anybody explai it?