Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #6058

Re: Transforming object properties?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
From Mike <mpearl1@gmail.com>
Newsgroups comp.lang.php
Subject Re: Transforming object properties?
Date Wed, 9 May 2012 14:57:10 -0700 (PDT)
Organization http://groups.google.com
Lines 25
Message-ID <21352106.71.1336600630360.JavaMail.geo-discussion-forums@pbmf10> (permalink)
References <16764404.423.1336520688722.JavaMail.geo-discussion-forums@pblw1> <t7gjq7hidbohqkohouq8rg3i7tlv0ecai4@4ax.com>
NNTP-Posting-Host 24.6.102.101
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1
X-Trace posting.google.com 1336600707 25297 127.0.0.1 (9 May 2012 21:58:27 GMT)
X-Complaints-To groups-abuse@google.com
NNTP-Posting-Date Wed, 9 May 2012 21:58:27 +0000 (UTC)
Cc jnorthau@yahoo.com.au
In-Reply-To <t7gjq7hidbohqkohouq8rg3i7tlv0ecai4@4ax.com>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=24.6.102.101; posting-account=AWSUmAoAAADZ_aGL56Bhq5_JkXGSFDhA
User-Agent G2/1.0
Xref csiph.com comp.lang.php:6058

Show key headers only | View raw


I didn't do a good job of presenting this, my apologies.

I have two tables, one with user info, the other with commission amounts.  I need to get a list of sales people that gives the total commissions for each status (there are four of them).   My SQL query looks like this:

SELECT name, status, SUM(commission) 
FROM transactions 
GROUP BY name, status
ORDER BY name ASC

This is giving the right results, but I will have multiple rows for each name, showing the status and total for that status:

Joe   new      10.00
Joe   pending  44.00
Joe   closed   88.00
etc.

I need a single row for each name, something like this:

name          new          pending          closed
Joe           10.00        44.00            88.00

Is there a way to create a sql query that will return this?  If not, how can I get the data in that format?

Thanks again!
Joe     

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Transforming object properties? Mike <mpearl1@gmail.com> - 2012-05-08 16:44 -0700
  Re: Transforming object properties? Jeff North <jnorthau@yahoo.com.au> - 2012-05-09 11:01 +1000
    Re: Transforming object properties? Mike <mpearl1@gmail.com> - 2012-05-09 14:57 -0700
      Re: Transforming object properties? Captain Paralytic <paul_lautman@yahoo.com> - 2012-05-10 03:24 -0700
      Re: Transforming object properties? Jeff North <jnorthau@yahoo.com.au> - 2012-05-15 10:28 +1000
        Re: Transforming object properties? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-05-15 20:09 +0200
  Re: Transforming object properties? "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-05-09 10:02 +0200
    Re: Transforming object properties? "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-05-09 10:05 +0200

csiph-web