Note that there are some explanatory texts on larger screens.

plurals
  1. POMysql show data in Pivot View
    primarykey
    data
    text
    <p>Sorry Guys, could not generate a fiddle since facing some issues with sqlfiddle.com</p> <p>I have a table in mysql database which is as follows:</p> <pre><code>Username mailtime mailid User4 3/23/2013 10:26 4473 User1 4/6/2013 16:13 10934 User4 4/6/2013 17:17 10957 User1 4/6/2013 23:56 11092 User2 4/7/2013 11:58 11187 User1 4/7/2013 12:06 11190 User4 4/7/2013 13:11 11216 User4 4/7/2013 13:14 11217 User1 4/7/2013 14:40 11245 User5 4/7/2013 15:52 11259 User1 4/7/2013 18:12 11303 User5 4/7/2013 19:56 11323 User1 4/7/2013 22:52 11358 User4 4/8/2013 11:13 11465 User1 4/8/2013 11:20 11475 User1 4/8/2013 11:35 11491 User4 4/8/2013 12:10 11511 User4 4/8/2013 12:38 11532 User4 4/8/2013 12:51 11540 User4 4/8/2013 13:06 11551 User1 4/8/2013 13:09 11552 User4 4/8/2013 13:15 11560 User1 4/8/2013 13:24 11572 User1 4/8/2013 14:01 11614 User4 4/8/2013 14:27 11640 User1 4/8/2013 15:41 11700 User5 4/8/2013 16:04 11730 User1 4/8/2013 17:40 11814 User4 4/9/2013 11:16 12117 User1 4/9/2013 12:41 12198 User1 4/9/2013 12:59 12209 User4 4/9/2013 13:58 12243 User4 4/9/2013 14:05 12250 User1 4/9/2013 14:15 12256 User4 4/9/2013 16:51 12351 User1 4/9/2013 17:33 12397 User1 4/9/2013 19:01 12455 User4 4/9/2013 19:15 12463 User5 4/9/2013 20:59 12517 User1 4/9/2013 21:26 12530 User1 4/9/2013 22:46 12561 User1 4/10/2013 1:01 12595 User1 4/10/2013 8:42 12631 User1 4/10/2013 10:18 12663 User1 4/10/2013 11:21 12697 User3 4/10/2013 11:27 12701 User4 4/10/2013 11:34 12705 User1 4/10/2013 15:26 12856 User4 4/10/2013 16:51 12909 User2 4/10/2013 16:53 12913 </code></pre> <p>The output that i require is as follows:</p> <pre><code>Username &lt; 5 days 6-Apr 7-Apr 8-Apr 9-Apr 10-Apr Grand Total User1 User2 User3 User4 User5 Grand Total </code></pre> <p>Not sure how to do this.</p> <p>The max mailtime is displayed in the 2nd last column and previous days in the previous columns and &lt; 5 days is cumilative of all the other days</p> <p>EDIT::</p> <p>The data that is required is the count of mailids</p> <p>The columns &lt; 5 days, 6-Apr, 7-Apr, 8-Apr, 9-Apr and 10-Apr are the columns from mailtime Column. If the max date from the column is say 25th Mar, the the columns should be &lt; 5 days, 20-Mar, 21-Mar, 22-Mar, 23-Mar, 24 Mar and 25-Mar</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload