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 is the new security features added in sql server 2016? : sql server security
last function used in MS Access to convert sql what function will use in sql
Can the “if update (colname)” statement be used in a delete trigger?
I create a separate index on each column of a table. What are the advantages and disadvantages of this approach? : Sql server database administration
In what three ways is the return statement used in a stored procedure?
What is tempdb in sql server?
How to modify the underlying query of an existing view?
How to disable a login name in ms sql server?
what is a transaction and what are acid properties? : Sql server database administration
Explain database normalization?
What are the different types of replication you can set up in sql server?
Write SQL queries on Self Join and Inner Join.
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)