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 6575179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:21:19+00:00 2026-05-25T15:21:19+00:00

I have some legacy code I’m maintaining and there’s a SQL query in there

  • 0

I have some legacy code I’m maintaining and there’s a SQL query in there that I don’t understand. I’m hoping someone here can explain the purpose of this to me. The query looks like this:

select * from product_performance 
where merchantid = 2151277 and clickday >= '2011-09-01' 
group by null;

When I run this query without the group by null at the end, I get 44 rows. When I run it with the group by null, I get 1 row — the first row in the previous set. What is happening here, and what is the purpose of using this grouping?

  • 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-05-25T15:21:21+00:00Added an answer on May 25, 2026 at 3:21 pm

    It’s grouping the entire query by a constant value, which makes it pick a row effectively at random to return. You could get the same results using LIMIT 1.

    Note that this idiom is not standard SQL, and may cause errors if you try it in other databases. In MySQL, you can disable this behavior by specifying the ONLY FULL GROUP BY SQL mode. See the documentation for more details.

    OTOH, LIMIT 1 is non-standard as well, but more widely supported, and the same effect may be achieved in databases compliant with SQL:2008 with the FETCH ... ONLY clause. See this for details on that.

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

Sidebar

Related Questions

We have some legacy code that compiles in Delphi 6. There are plans to
I've got some legacy code that I really don't have time to rewrite. Is
We have some legacy code that needs to identify in the Page_Load which event
I have some legacy code that was used to monitor my applications cpu,memory etc
I have some legacy C code that I recently compiled on Linux. On the
Today, I have seen some legacy code. In the destructor there is a statement
We have some legacy ASP.NET code that detects if a request is secure, and
I have some really complicated legacy code I've been working on that crashes when
I have been working on some legacy C++ code that uses variable length structures
I have some legacy code that uses Interlocked.Equals to compare values. The values may

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.