Lews_Therin
Weaksauce
- Joined
- Jul 1, 2005
- Messages
- 64
This is my current query:
SELECT FirstVisit, COUNT(*), Prov1 FROM pat_dat GROUP BY FirstVisit, Prov1 ORDER BY FirstVisit;
Which produces output like this:
I'd like to be able to format the output like this, for easier graphing in Excel:
What sort of things would allow me to do that?
SELECT FirstVisit, COUNT(*), Prov1 FROM pat_dat GROUP BY FirstVisit, Prov1 ORDER BY FirstVisit;
Which produces output like this:
Code:
+------------+----------+-------+
| FirstVisit | COUNT(*) | Prov1 |
+------------+----------+-------+
| 2005-12-06 | 1 | AAAA |
| 2005-12-06 | 1 | BBBB |
| 2005-12-07 | 1 | BBBB |
| 2005-12-08 | 5 | AAAA |
| 2005-12-08 | 1 | CCCC |
| 2005-12-08 | 3 | BBBB |
| 2005-12-09 | 1 | AAAA |
| 2005-12-09 | 1 | CCCC |
| 2005-12-09 | 1 | BBBB |
| 2005-12-10 | 3 | CCCC |
+------------+----------+-------+
I'd like to be able to format the output like this, for easier graphing in Excel:
Code:
+------------+------+------+------+
| FirstVisit | AAAA | BBBB | CCCC |
+------------+------+------+------+
| 2005-12-06 | 1 | 1 | 0 |
| 2005-12-07 | 0 | 1 | 0 |
| 2005-12-08 | 5 | 3 | 1 |
| 2005-12-09 | 1 | 1 | 1 |
| 2005-12-10 | 0 | 0 | 3 |
+------------+------+------+------+
What sort of things would allow me to do that?