Re: Help on query report...

From: Date: Fri, 17 Nov 2006 03:28:34 +0000
Subject: Re: Help on query report...
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-42696@lists.php.net to get a copy of this message
Suprie wrote:
dear all, i have this table id | contract No | site id | handover date |status| finishing date | contract value|actual value
1 | T0001          | LOS01 | 12-Apr-06        | Done | 11-Apr-06     |
12,000          | 12,000
2 | T0002          | LOS02 | 12-Apr-06        | Done | 11 Apr-06     |
11,000          | 11,000
3 | T0001          | LOS02 |                       | Done | 13-Apr-06
  | 13,000          | 13,000
4 | T0003          | LOS01 |                       | Cancel |
       | 11,000          |
now my manager asked me to produce summary report like : Contract No | TOTAL site | Total Cancelled | Total Active | Handovered | Contract Value |
T0001         |       2          |          0            |         2
    |        1         |  25,000            |
T0002         |      1           |          0            |         1
    |       1          |  11,000            |
T0003         |      1           |          1            |         0
    |       0          |   11,000           |
is there some way to do it in mySQL? i'm using php 5 and mysql 5.1 right now i'm doing it manually, but i thinks it was really complex...Could somebody help me with the query ? many thanks,
Show us the query you already have rather than us just guessing the tables etc. -- Postgresql & php tutorials http://www.designmagick.com/

« previous php.db (#42696) next »