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 is the fastest way to permanently delete a 1 million row table named customers?
What is openxml in sql server?
How to choose all records from the table?
Can group by and orderby be used together?
What is user-defined function? Explain its types i.e. Scalar and inline table value user-defined function?
How can you tell if a database object is invalid?
What is the purpose of sql profiler in sql server? : sql server database administration
What is postgresql server?
How will you monitor replication activity and performance? What privilege do you need to use replication monitor? : sql server replication
How to retrieve error messages using odbc_errormsg()?
What are the new features of sql server 2012 reporting service?
Explain what stored procedure sp_replcounters is used for? : sql server replication
What xml support does the sql server extend?
What is mean by dml?
How to list all schemas in a database?