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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:28:32+00:00 2026-05-18T02:28:32+00:00

I tried this query on MySQL server (5.1.41)… SELECT max(volume), dateofclose, symbol, volume, close,

  • 0

I tried this query on MySQL server (5.1.41)…

SELECT max(volume), dateofclose, symbol, volume, close, market FROM daily group by market

I got this result:

max(volume) dateofclose symbol  volume  close   market
287031500     2010-07-20  AA.P    500     66.41   AMEX
242233000     2010-07-20  AACC    16200   3.98    NASDAQ
1073538000   2010-07-20  A       4361000 27.52   NYSE
2147483647   2010-07-20  AAAE.OB 400     0.01    OTCBB
437462400     2010-07-20  AAB.TO  31400   0.37    TSX
61106320       2010-07-20  AA.V    0       0.24    TSXV

As you can see, the maximum volume is VERY different from the ‘real’ value of the volume column?!?

The volume column is define as int(11) and I got 2 million rows in this table but it’s very far from the max of MyISAM storage so I cannot believed this is the problem!? What is also strange is data get show from the same date (dateofclose). If I force a specific date with a WHERE clause, the same symbol came out with different max(volume) result. This is pretty weird…

Need some help here!

UPDATE :

Here’s my edited “working” request:

SELECT a.* FROM daily a 
INNER JOIN ( 
SELECT market, MAX(volume) AS max_volume 
FROM daily 
WHERE dateofclose = '20101108' 
GROUP BY market 
) b ON 
a.market = b.market AND 
a.volume = b.max_volume

So this give me, by market, the highest volume’s stock (for nov 8, 2010).

  • 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-18T02:28:32+00:00Added an answer on May 18, 2026 at 2:28 am

    As you can see, the maximum volume is VERY different from the ‘real’ value of the volume column?!?

    This is because MySQL rather bizarrely doesn’t GROUP things in a sensical way.

    Selecting MAX(column) will get you the maximum value for that column, but selecting other columns (or column itself) will not necessarily select the entire row that the found MAX() value is in. You essentially get an arbitrary (and usually useless) row back.

    Here’s a thread with some workarounds using subqueries:
    How can I SELECT rows with MAX(Column value), DISTINCT by another column in SQL?

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

Sidebar

Related Questions

Surprise -- this is a perfectly valid query in MySQL: select X, Y from
I've honestly tried this left and right and still find that my mirror server,
(I've tried this in MySql) I believe they're semantically equivalent. Why not identify this
I have a troublesome MySQL query as follows: SELECT camera_id, ((avg(low_price) + avg(high_price)) /
i got problem with a query, got something like this command.CommandText = SELECT +
I tried this XAML: <Slider Width=250 Height=25 Minimum=0 Maximum=1 MouseLeftButtonDown=slider_MouseLeftButtonDown MouseLeftButtonUp=slider_MouseLeftButtonUp /> And this
I tried this: ALTER TABLE My.Table DROP MyField and got this error: -MyField is
I tried this but it does not seem to be valid syntax. <xsl:element name=$myElementName></xsl:element>
I've tried this: string newScript = textBox1.Text; HtmlElement head = browserCtrl.Document.GetElementsByTagName(head)[0]; HtmlElement scriptEl =
I have tried this... Dim myMatches As String() = System.Text.RegularExpressions.Regex.Split(postRow.Item(Post), \b\#\b) But it is

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.