Need help with data arrays |
(03-16-2015, 12:34 PM)RobertSF Wrote:Thanks again for coming back and explaining clearly. I've got phpmyadmin and have been using it most of the day to try to get what I want from my database. I don't think I was very good at explaining the nature of the problem. I'm building a staff absence tracking application so Ihave multiple staff and multiple absence 'types' the 'parent' table is staff and the 'child' table is events ... therecan be multiple different absence types in in my child table and I only need totals of two of them ... I also have to select events that occur in a date range. However, the good news for me is that I've come up with a solution (inspired by your previous post) and here it is:(03-16-2015, 04:46 AM)blackbulldog Wrote: Sorry to be a pain . . . Code: $SQLstring="SELECT * This gives me to total of event type 1 and the total of event type 2 between the relevant dates for each member of staff. The result set contains the staffid 3 times (once from the SELECT * and once each because of the select in the subqueries) and I don't know how to get rid of the two 'extra' ones. Also, if there are no records of the specified type in the date range for any staff member the the totals return as NULL ... is there a way to get the query to return 0 rather than NULL? also, is this solution a good one or could I have done better? |
Messages In This Thread |
Need help with data arrays - by blackbulldog - 03-14-2015, 08:28 AM
RE: Need help with data arrays - by RobertSF - 03-14-2015, 04:01 PM
RE: Need help with data arrays - by blackbulldog - 03-15-2015, 05:04 AM
RE: Need help with data arrays - by RobertSF - 03-15-2015, 05:42 AM
RE: Need help with data arrays - by blackbulldog - 03-16-2015, 04:46 AM
RE: Need help with data arrays - by RobertSF - 03-16-2015, 12:34 PM
RE: Need help with data arrays - by blackbulldog - 03-16-2015, 01:27 PM
RE: Need help with data arrays - by RobertSF - 03-16-2015, 05:36 PM
RE: Need help with data arrays - by RobertSF - 03-16-2015, 03:24 PM
RE: Need help with data arrays - by blackbulldog - 03-17-2015, 01:57 AM
RE: Need help with data arrays - by RobertSF - 03-17-2015, 03:21 AM
|