Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is the fastest way to permanently delete a 1 million row table named customers?

1234


What is openxml in sql server?

1154


How to choose all records from the table?

1041


Can group by and orderby be used together?

995


What is user-defined function? Explain its types i.e. Scalar and inline table value user-defined function?

887


How can you tell if a database object is invalid?

1060


What is the purpose of sql profiler in sql server? : sql server database administration

1084


What is postgresql server?

976


How will you monitor replication activity and performance? What privilege do you need to use replication monitor? : sql server replication

1060


How to retrieve error messages using odbc_errormsg()?

1033


What are the new features of sql server 2012 reporting service?

133


Explain what stored procedure sp_replcounters is used for? : sql server replication

1488


What xml support does the sql server extend?

991


What is mean by dml?

985


How to list all schemas in a database?

1041