You could simply do something like

SELECT Date, COUNT(Date) AS C_Date
GROUP BY Date
ORDER BY C_Date DESC

This would give you back a result set as follows

Date    | C_Date
--------------
29      |       3
30      |       3
31      |       2
28      |       1

You could put that in a temp table and select the top from that ...

---
Rob

**************************
Rob Cherry
mailto:[EMAIL PROTECTED]
+27 21 447 7440
Jam Warehouse RSA
Smart Business Innovation
http://www.jamwarehouse.com
**************************


-----Original Message-----
From: Hu Qinan [mailto:[EMAIL PROTECTED]
Sent: Monday, March 24, 2003 2:08 PM
To: [EMAIL PROTECTED]
Subject: group by quesion?


How to write this sql?

I have a table:

Date   |    Low     High
------------------------------
...
28       |    1        7
-------------------------
29       |    1        7
29       |    2        3
29       |    4        10
----------------------------
30       |    1        7
30       |    2        3
30       |    4        10
-----------------------------
31       |    0        4
31       |    6        8

I try to extract the "Date" which has the most frequently occured
combination of (Low, High).

For example, Date- 29, 30 should be extracted since ((1, 7), (2, 3), (4,
10)) occured more often than (1, 7) and ((0, 4), (6, 8)).

I can't use
GROUP BY low, high
since then (1, 7) will be identified as the most frequently occured Low and
High.

If it is not clear, please ask me.

All information contained in this email is confidential and may be used by
the intended recipient only.


All information contained in this email is confidential and may be used by the 
intended recipient only.

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to