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 are the purposes of floor and sign functions?

1021


Why use “in” clause in sql server?

1124


What does the on update no action do?

1079


What is an example of a foreign key?

1033


What are date and time data types in ms sql server?

1163


What are difference between Cluster index and Non-Cluster index?

1134


What is dbcc?

1181


How many types of built in functions are there in sql server 2012?

970


What are the basic features of a trigger in ms sql server?

1269


Which data type columns are the best candidates for full-text indexing?

1026


Explain encryption of entire databases without the need for application changes in sql server 2008?

1091


What is bit data type?

1083


What are the basic functions for master, msdb, model, tempdb and resource databases?

1037


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

1729


How to sort query output in descending order in ms sql server?

985