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
How you can get a list of all the table constraints in a database? : Sql server administration
List some major differences between triggers and stored procedures?
What is the process of normalising?
What are the different types of Indexes available in SQL Server?
What do you understand by coalesce in sql server?
What are the differences in Clustering in SQL Server 2005 and 2008 or 2008 R2?
Explain atomicity?
How to set database to be single_user in ms sql server?
What is a data collection table?
What is logshipping and its purpose?
Define indexes?
What are the main differences between #temp tables and @table variables and which one is preferred?
What is the syntax to execute the sys.dm_db_missing_index_details?
What is the difference between functions and scalar functions?
Can we hide the definition of a stored procedure from a use?