can any one answer this query,thank you in advance

Table 1 has 2 columns: EmployeeId, T shirtsize(values can
be 1,2,3)
Table 2 has 2 columns: EmployeeId, Region
Write SQL to Find the region which has the largest number
of people with Tshirt size=3

Answer Posted / lakram5455

SELECT a.Region FROM
(SELECT TOP(1) a.TSize, COUNT(a.EId) AS TotalCount, b.Region
FROM emp a INNER JOIN Region b ON b.EId = a.EId WHERE TSize
= 3 GROUP BY a.TSize, b.Region ORDER BY TotalCount DESC) a

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to create a dynamic cursor with the dynamic option?

720


Can two tables have the same primary key?

868


Explain about temporary stored procedure?

681


When should you use an instead of trigger?

702


What is single-user mode and what are the steps you should follow to start sql server in single-user mode?

743






What is function of CUBE ?

760


Show Practically Sql Server Views are updatable?

785


Do you know nested transaction?

682


What is apply operator in sql?

761


How to read data in a table with "select" statements?

735


Where are full-text indexes stored?

729


What is the openxml statement in sql server?

730


What are two difference between sql azure and azure tables?

153


hi, how to link a text file and a .rpt file in my tables of sql server and to retrieve those records for further use. reply me as soon as possible.

1744


How to connect php with different port numbers?

723