been advised to upgrade my mysql platform for some added benefits and have done so. one of the items I was looking at is the "with rollup" feature. definately what i am looking for. now....here's where it might get complicated.
is there a way to only display the records in a manner where as there is only one entry you will display it and not the rollup line (or visa versa) and where there are multiple entries, you display those records and the rollup?
this is to be displayed on my webpage not through mysql window if that helps.
example:
select yr, count(yr) as nr, ocode from table1 where dc=1 group by yr,oc with roll up
displays:
+--------+----+--------+
| yr | nr | ocode |
+--------+----+--------+
| 2004 | 2 | 1 |
| 2004 | 2 | [NULL] |
| 2005 | 2 | 1 |
| 2005 | 1 | 3 |
| 2005 | 3 | [NULL] |
| [NULL] | 5 | [NULL] |
+--------+----+--------+
since there is only one grouping for 2004, i only want to display one record as opposed to the two that are showing
since 2005 has two groupings, i would like to display all three of those records.
so my final display would look like this:
+--------+----+--------+
| yr | nr | ocode |
+--------+----+--------+
| 2004 | 2 | 1 |
| 2005 | 2 | 1 |
| 2005 | 1 | 3 |
| 2005 | 3 | [NULL] |
| [NULL] | 5 | [NULL] |
is this possible?
is there a way to only display the records in a manner where as there is only one entry you will display it and not the rollup line (or visa versa) and where there are multiple entries, you display those records and the rollup?
this is to be displayed on my webpage not through mysql window if that helps.
example:
select yr, count(yr) as nr, ocode from table1 where dc=1 group by yr,oc with roll up
displays:
+--------+----+--------+
| yr | nr | ocode |
+--------+----+--------+
| 2004 | 2 | 1 |
| 2004 | 2 | [NULL] |
| 2005 | 2 | 1 |
| 2005 | 1 | 3 |
| 2005 | 3 | [NULL] |
| [NULL] | 5 | [NULL] |
+--------+----+--------+
since there is only one grouping for 2004, i only want to display one record as opposed to the two that are showing
since 2005 has two groupings, i would like to display all three of those records.
so my final display would look like this:
+--------+----+--------+
| yr | nr | ocode |
+--------+----+--------+
| 2004 | 2 | 1 |
| 2005 | 2 | 1 |
| 2005 | 1 | 3 |
| 2005 | 3 | [NULL] |
| [NULL] | 5 | [NULL] |
is this possible?