This topic is locked

Getting some sort of a Pivot-Table with Dates....

8/31/2024 1:44:29 PM
PHPRunner General questions
B
bru author

I have a school class list (SQL query with kids who come only for examlpe on Mondays)... now I want to extend this list with an attendance list that includes all Mondays for a semester (or Year) starting from a specific date.
I tried to get a Pivot-Table from the starting date of the course but in sql only this is not really working.. some dynamic php would be more adequate... but this is above my php knowledge...
I have a table with all the school Holidays where there are no courses... these dates should be exempted on the list

I should have a list like this: (easy in excel) but how to implement this in PHPR
Kid | 2024-08-12 | 2024-08-19 | 2024-08-26 | etc... | |
KidName1 | | | | |
KidName2 |
KidName3 |

Thanks for any hints...

C
Chris Whitehead 9/5/2024

Here's how to pivot the data in mysql, this is an example from the net but you can adapt it to suit your needs

SELECT
CompanyName,

SUM(CASE WHEN (action='EMAIL') THEN 1 ELSE 0 END) AS Email,
SUM(CASE WHEN (action='PRINT' AND pagecount=1) THEN 1 ELSE 0 END) AS Print1Pages,
SUM(CASE WHEN (action='PRINT' AND pagecount=2) THEN 1 ELSE 0 END) AS Print2Pages,
SUM(CASE WHEN (action='PRINT' AND pagecount=3) THEN 1 ELSE 0 END) AS Print3Pages
FROM
Company
GROUP BY
CompanyName

HJB 9/6/2024

https://www.youtube.com/watch?v=w2eNBE_EjiE&t=2s

The above tutorial, though dating back to 2011, still talks on the issue,
named "How to setup many-to-many relationships" inside PHPRunner.

In other words, this tutorial is NOT providing answers on your current needs
in first instance, yet only describes the way on how to handle the basics,
here on how to administer "many" kids in regard to "many" lessons by a
proper basic setup to start from in regard to further "date" or else oriented
structuring of the appliance itself.

In simple terms, if the basic setup is WRONG by means of its approach to
what is required to get "administered", it would be difficult to correct things
later on by whatsoever code snippets in mind.