Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To 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 December 5th, 2005, 02:43 PM
Authorized User
Join Date: Nov 2005
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default group extra colums

Hello everyone,

mysql group by with rollup is a very good tool to analyze data.

My question is, what if i want populate extra column with the report but summarized. for example, i want to report sum(amount) summarized with year and sales person, so, i wrote sql something like

select sum(amt),year,salesid group by year,salesid with rollup

Now my report also needs info about sales first name, last name, email, phone,... if I group all of them to my query, it will populate too many redundant lines.

So, any body can let me know how to populate extra columns attached to key column without applying group by clause?

Thank you in advance,

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to Distinct two colums but select other colums ALPEN07 SQL Server 2005 2 April 5th, 2008 06:08 AM
onlick display more colums mateenmohd Classic ASP Basics 5 July 28th, 2007 07:12 AM
Restart new group number in Group Footer sukarso Crystal Reports 2 October 13th, 2006 12:11 PM
Dynamically adding Colums to datagrid ? vivekshah C# 0 April 15th, 2006 02:54 AM
Sorting on mulitple colums Greg Griffiths Javascript 0 June 20th, 2003 12:07 PM

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