[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mysql
Subject:    Strange result of Group by on real values
From:       "Joris Kinable" <deus87 () gmail ! com>
Date:       2008-01-30 17:37:55
Message-ID: 54f9ea8f0801300937x1419a363j4aae0d1e973c408d () mail ! gmail ! com
[Download RAW message or body]

Evening,

Could someone explain the result of the Query 2? Query 2 does a GROUP
BY avgOctets, but still there are duplicate avgOctets in my result
set! Boxplot(octets,"AVG",0) is a UDF which returns REAL values. In
this case, the real values have no decimals.
The only reasonable explanation I could think of is that the REAL
value returned by boxplot(...) is an estimation and therefore should
be casted to an INTEGER before comparison by GROUP BY is possible?


Inner Query: SELECT boxplot(octets,"AVG",0) AS avgOctets FROM
joris_filter GROUP BY ipv4_src, ipv4_dst

Result:

avgOctets
46
46
46
46
46
46
46
40
46
46
46
144
48
48
....


Query 2: (With "inner query" as inner query):

SELECT avgOctets, COUNT(*) AS frequency FROM
  (
    SELECT boxplot(octets,"AVG",0) AS avgOctets FROM joris_filter
GROUP BY ipv4_src, ipv4_dst
) avarages
GROUP BY avgOctets ORDER BY avgOctets;

Result:

avgOctets    frequency
40           350026
41           1
41           1
41           6
41           2
41           3
41           1
42           1
...            ....

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=mysql-marcsub@progressive-comp.com

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic