Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > MySQL
|
MySQL General discussion about the MySQL database.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the MySQL section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 10th, 2007, 01:25 AM
Registered User
 
Join Date: Oct 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Aggregating MySQL Data help please!

Hi,

I am a relatively new MySQL user and I wonder if anybody out there knows a way to run an aggregate query on a table like mine. My table contains weekly data on teams and points won. On week 1 Team A plays at Home, on Week 2 Team A plays away, on Week 3 Team A is at home again etc, etc

The table fields are as follows;

Wk_No, Hosts, H_pts, Visitors, V_pts

Typical data in the fields would be as follows;
1, Team A, 12, Team D, 2
1, Team C, 8, Team B, 6
2, Team B, 10, Team A, 4
2, Team D, 7, Team C, 7
3, Team A, 8, Team B, 6
3, Team D,14, Team C, 0

I am trying to group the data by team and totalise the pts won away and the points won at home as Tpts scored by team in the form of a league table.

I would like my result to look like this;
Team TPts
Team A 24
Team B 22
Team C 15
Team D 23

I have tried using temporary tables which works well on the MySql server but I can't get it to display on my web page via a php page. I don't have permissions to create VIEWS on my server either!

Are there any MySQL whizzes out there that can advise me? This is driving me nuts!

Any advice would be much appreciated

 
Old October 18th, 2007, 08:39 AM
Authorized User
 
Join Date: Oct 2006
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Default

u want to total score of the a team ,in oracle there is two function like cube and roll up,using which we can show the output like above.in mysql5 i donot know exactly.

With thanks
rajesh,
India





Similar Threads
Thread Thread Starter Forum Replies Last Post
Navigating through the data in MySQL prad_a JSP Basics 1 March 23rd, 2007 07:48 AM
Navigating through the data in MySQL prad_a MySQL 4 March 23rd, 2007 01:58 AM
MySql data dump itHighway Beginning PHP 2 May 29th, 2006 01:15 PM
MySql data dump itHighway Classic ASP Databases 0 May 28th, 2006 06:12 PM
cannot insert into mysql:data LogicalDevloper Pro PHP 1 December 22nd, 2004 09:08 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.