i correct my example :
select USERID,IF(DAY='2003-01-02',SUM(LIS_QUANTITY),0) as
2003-01-02,IF(DAY='2003-01-03',SUM(LIS_QUANTITY),0) as
2003-01-03...how_many_days_you_wish....from YOUR_TABLES where
> YOUR_CONDITIONS GROUP BY DAY;
Regards,
Gelu
_____________________________________________________
G.NET SOFTWARE COMPANY
Permanent e-mail address : gg@stripped
gelugogancea@stripped
----- Original Message -----
From: "Gelu Gogancea" <ggelu@stripped>
To: "DANIEL GADDIS" <DANIEL.GADDIS@stripped>; <mysql@stripped>
Sent: Friday, March 14, 2003 11:05 PM
Subject: Re: Paul, do you address this in any of your books?
> Hi,
> You can try to use IF(),CASE() function in the SQL statement.
>
> Eg.
>
> select USERID,IF(DAY='2003-01-02',COUNT(*),0) as
> 2003-01-02,IF(DAY='2003-01-03',COUNT(*),0) as
> 2003-01-03...how_many_days_you_wish....from YOUR_TABLES where
> YOUR_CONDITIONS GROUP BY DAY;
>
>
> Regards,
>
> Gelu
> _____________________________________________________
> G.NET SOFTWARE COMPANY
>
> Permanent e-mail address : gg@stripped
> gelugogancea@stripped
> ----- Original Message -----
> From: "DANIEL GADDIS" <DANIEL.GADDIS@stripped>
> To: <mysql@stripped>
> Sent: Friday, March 14, 2003 10:40 PM
> Subject: Paul, do you address this in any of your books?
>
>
>
> I'm running MySql 4.0.10-gamma-max-nt-log
>
> I have 1 table like the one below...
>
> +------------+---------+--------------+
> | DAY | USERID | LIS_QUANTITY |
> +------------+---------+--------------+
> | 2003-01-02 | H0850A1 | 539 |
> | 2003-01-02 | LBBSWJR | 7 |
> | 2003-01-02 | O0600B3 | 21 |
> | 2003-01-03 | H0850A1 | 6 |
> | 2003-01-03 | H2610A1 | 51 |
> | 2003-01-03 | O0600B3 | 19 |
> | 2003-01-04 | H0850A1 | 8 |
> | 2003-01-04 | H2610A1 | 13 |
> | 2003-01-04 | LBBSWJR | 3 |
> +------------+---------+--------------+
>
> I would like a sql query to produce output like the following...
>
> +---------+------------+------------+------------+
> | USERID | 2003-01-02 | 2003-01-03 | 2003-01-04 |
> +---------+------------+------------+------------+
> | H0850A1 | 539 | 6 | 8 |
> | H2610A1 | | 51 | 13 |
> | LBBSWJR | 7 | | 3 |
> | O0600B3 | 21 | 19 | |
> +---------+------------+------------+------------+
>
> Can I do this just by using sql and not adding php, perl, or any
> other language?
>
> If mysql can't handle this with sql only, would it be able to do it
> once subselects or other features are available in future releases?
>
> Anyone used postgresql? I wonder if it could handle it.
>
> Any thoughts?
>
> Thanks,
> Daniel
>
>
>
>
> ---------------------------------------------------------------------
> Before posting, please check:
> http://www.mysql.com/manual.php (the manual)
> http://lists.mysql.com/ (the list archive)
>
> To request this thread, e-mail <mysql-thread134769@stripped>
> To unsubscribe, e-mail <mysql-unsubscribe-ggelu=arctic.ro@stripped>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
>
>
> ---------------------------------------------------------------------
> Before posting, please check:
> http://www.mysql.com/manual.php (the manual)
> http://lists.mysql.com/ (the list archive)
>
> To request this thread, e-mail <mysql-thread134775@stripped>
> To unsubscribe, e-mail <mysql-unsubscribe-ggelu=arctic.ro@stripped>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
>