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
What is PROJECTION Operation?
Can a stored procedure call itself or a recursive stored procedure? How many levels of sp nesting is possible?
Explain Geography datatype in SQL Server
What are views in ms sql server?
Do you know sql server 2008 introduces automatic auditing?
How can we determine what objects a user-defined function depends upon?
Write an SQL query to obtain the 2nd highest salary.
You want to be sure that queries in a database always execute at the maximum possible speed. To achieve this goal you have created various indexes on tables which other statement will keep the database in good condition?
What is the rdl file?
What are group functions in query statements in ms sql server?
What are the Advantages of using CTE in sql server?
What are the steps to take to improve performance of a poor performing query? : sql server database administration
Write a program to fetch first 10 records from a file?
How to insert multiple rows with one insert statement in ms sql server?
Why should one not prefix user stored procedures with ‘sp_’?