At 14:40 -0600 3/14/03, DANIEL GADDIS wrote:
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
Actually, if I remember correctly, I don't cover this anywhere.
I recommend reading the cross-tabulation article on mysql.com that
an earlier response referred to.
--
Paul DuBois, [EMAIL PROTECTED]
http://www.kitebird.com/
sql, query
---------------------------------------------------------------------
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 <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php