Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8015533
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T20:16:52+00:00 2026-06-04T20:16:52+00:00

Suppose I have two tables tblEmployee and tblEmpSalary . I need to write a

  • 0

Suppose I have two tables tblEmployee and tblEmpSalary. I need to write a SQL statement to get a list of all employees, their name and salary, who receive the highest salary in each department.

Sample table data is here:

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T20:16:54+00:00Added an answer on June 4, 2026 at 8:16 pm
    SELECT e.strEmpName, s.monSalary
    FROM tblEmployee e
    JOIN tblEmpSalary s ON e.intEmployeeID = s.intEmployeeID
    WHERE e.strDepartment + '-' + CAST(s.monSalary AS varchar(20)) IN (
         SELECT e2.strDepartment + '-' + CAST(MAX(s2.monSalary) AS varchar(20))
         FROM tblEmployee e2
         JOIN tblEmpSalary s2 ON e2.intEmployeeID = s2.intEmployeeID
         GROUP BY e2.strDepartment)
    

    Disclaimer: I can’t test this query right now, so it could have some small detail wrong.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In SQL server 2008: Suppose I have two tables. Table1 has 3 fields: Name,
I use SQL Server 2000. Suppose I have two tables like the following: Area
I have two simple tables let's say country and state . Suppose, I need
Suppose I have two SQL tables: Customers and PhoneNumbers. Suppose that Customers has the
I have two tables :- tbl_ticket_categories(id,category_name,site_referer) tbl_tickets(id,title,category_name,site_referer) I have to get all title from
Suppose I have two tables tab1, tab2. Full text indexes created on all varchar
Suppose I have two tables, - emp(empId number(1),empName varchar2(50)) and - manager(manId number(5),managerName varchar2(100))
Suppose we have two tables Foo and Bar. I have an association table Foo_Bar
Suppose I have two tables Main and Other like the following: Main +----------+-----------------------------------+ |
Suppose I have two tables that are linked (one has a foreign key to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.