Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
How To Divide Query Output into Groups
How To Divide Query Output into Groups? - MySQL FAQs - SQL SELECT Query Statements with GROUP BY
✍: FYIcenter.com
You can divide query output into multiple groups with the GROUP BY clause. It allows you specify a column as the grouping criteria, so that rows with the same value in that column will be considered as a single group. When the GROUP BY clause is specified, the select statement can only be used to return group level information. The following script gives you a good GROUP BY example:
mysql> SELECT tag, COUNT(*), MIN(created), AVG(counts) FROM fyi_links GROUP BY tag; +------+----------+---------------------+-------------+ | tag | COUNT(*) | MIN(created) | AVG(counts) | +------+----------+---------------------+-------------+ | DBA | 3 | 2005-01-01 00:00:00 | 3.6667 | | DEV | 2 | 2004-01-01 00:00:00 | 4.0000 | | SQA | 2 | 2003-01-01 00:00:00 | 7.0000 | +------+----------+---------------------+-------------+ 3 rows in set (0.07 sec)
2007-05-11, 7860👍, 0💬
Popular Posts:
What Happens If a Hyper Link Points to a Music File? - XHTML 1.0 Tutorials - Understanding Hyper Lin...
How To Blend a Color Layer to a Image? - PSP Tutorials - Fading Images to Background Colors with PSP...
.NET INTERVIEW QUESTIONS - How can you avoid deadlock in threading? A good and careful planning can ...
Jack developed a program by using a Map container to hold key/value pairs. He wanted to make a chang...
How To Get the Last ID Assigned by MySQL? - MySQL FAQs - Managing Tables and Running Queries with PH...