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
What keyword you will use to get schema appended to the result set of a ‘for xml’ query?
What is inline table-value user-defined function?
What do you understand by replication in sql server?
Explain in brief how sql server enhances scalability of the database system?
What is the difference between executequery () and executeupdate ()?
How to return the date part only from a sql server datetime datatype?
What are the pre-defined functions in the sql server?
What is the difference between stored procedure and user defined functions?
Once setting replication, is it potential to own a publisher as sixty four bit sql server and distributor or subscribers as a thirty two bit sql server?
Explain various On-Delete options in a DB table. Which is the default option?
What is the recovery model?
What is attribute hierarchy? : sql server analysis services, ssas
Differentiate between a local and a global temporary table?
What is transact-sql language?
List the different types of collation sensitivities in sql server?