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

  • SEARCH
  • Home
  • 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 8284199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T11:01:02+00:00 2026-06-08T11:01:02+00:00

When I am trying to do this select first_name from employees group by salary,first_name

  • 0

When I am trying to do this

select first_name from employees 
group by salary,first_name
having salary between 0 and 4800

I am getting 49 records

When I am trying to do this I am getting no results

select first_name from employees 
group by salary,first_name
having salary between 0 and (max(salary)/5)

Here select max(salary)/5 from employees fetches : 4800

This is simple but I don’t know what silly mistake I am doing

  • 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-08T11:01:03+00:00Added an answer on June 8, 2026 at 11:01 am

    In this statement

    select first_name from employees 
    group by salary,first_name
    having salary between 0 and (max(salary)/5)
    

    you’re grouping by salary and first_name, which is likely grouping by just one row. You’re essentially looking for X that’s between 0 and X/5, which is likely to return no results.

    In this statement

    select max(salary)/5 from employees fetches
    

    you’re grouping by nothing, so you get the max salary of everyone.

    I think this

    select first_name from employees 
    WHERE salary between 0 and (SELECT max(salary) FROM employees)/5
    

    is what you’re looking for

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

Sidebar

Related Questions

I'm trying this: SELECT FacilityID, FacilityName, CMSProviderID, [Provider Number] FROM G2_Facility, SCIPHospitalCompare WHERE [Provider
i'm trying to do this query: SELECT * FROM TABLE WHERE value1='THIS'S AN EXAMPLE'.
I am trying to do something like this: select char_length(select text_field from table where
I'm trying to do something like this: SELECT MAX( ADDDATE(expirationdate, INTERVAL 1 YEAR), ADDDATE(now(),
Im trying from postgres console this command: select sim.id as idsim, num.id as idnum
How can I subtract the result of this query: SELECT COUNT(Laptops) FROM (SELECT aaaUser.FIRST_NAME
I am trying to build the following SQL statement: SELECT `users_table`.*, `users_data`.`first_name`, `users_data`.`last_name` FROM
Trying to do something like this: select 'Setup for Car ' + CAST(varchar(50), @CarID)
I am trying to optimize a query that does something like this: SELECT ...
I'm trying to perform a DISTINCT clause on a query like this SELECT DISTINCT

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.