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
What are the purposes of floor and sign functions?
Why use “in” clause in sql server?
What does the on update no action do?
What is an example of a foreign key?
What are date and time data types in ms sql server?
What are difference between Cluster index and Non-Cluster index?
What is dbcc?
How many types of built in functions are there in sql server 2012?
What are the basic features of a trigger in ms sql server?
Which data type columns are the best candidates for full-text indexing?
Explain encryption of entire databases without the need for application changes in sql server 2008?
What is bit data type?
What are the basic functions for master, msdb, model, tempdb and resource databases?
how can you select rexcord(rows) from table A which is not present in Table B . Id being the FK in Table B referencing to ID Table A
How to sort query output in descending order in ms sql server?