Question

I've been working on a project where I have 3 tables of dates, times and usernames and when I join them the last view is:

same date - same time - diff username
same date - same time - diff username
diff date - diff time - diff username

An example with real data would be:

2014-01-03 | 10.08 | alexrussell
2014-01-05 | 11.15 | geartz
2014-01-05 | 14.23 | geartz
2014-02-02 | 13.44 | alexrussell
2014-02-02 | 13.44 | geartz
2014-02-02 | 18.21 | alexrussell

What I'm trying is to create a table where the data that's the same from row to row is grouped:

 -----------------------------------
| Date       | Time  | Username     |
|------------|-------|--------------|
| 2014-01-03 | 10.08 | alexrussell  |
|------------|-------|--------------|
|            | 11.15 | geartz       |
| 2014-01-15 |-------|--------------|
|            | 14.23 | geartz       |
|------------|-------|--------------|
|            |       | alexrussell  |
|            | 13.44 |--------------|
| 2014-02-02 |       | geartz       |
|            |-------|--------------|
|            | 18.21 | alexrussell  |
 -----------------------------------

I have 1 object and I'm using foreach to parse it. I tried several selects with distinct but that way, I can't include other objects in table so code gives error like 1 select with distinct for date and 1 for the rest which have "where" statement. I tried 1 object with several arrays in it but again since I'm using foreach, I can only fill 1 column and next column requires other object.

I also tried giving a rowspan per object count but It didn't work since I can't exactly get the user count.

There must be a way and I'm totally stuck on this. Probably I'm not the first one encountering a problem like this.

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top