Welcome Guest, Not a member yet? Register   Sign In
Need help with data arrays
#9

(This post was last modified: 03-16-2015, 05:38 PM by RobertSF.)

(03-16-2015, 01:27 PM)blackbulldog Wrote: 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.
Oh, cool, that's easy! Instead of doing SELECT *, just name the fields that you want. Big Grin

From your two subqueries, I think you only need the SUM() fields, a.total_absence and s.total_sickness.

(03-16-2015, 01:27 PM)blackbulldog Wrote: also, is this solution a good one or could I have done better?
I played and played with it and couldn't find anything better. I think you got it! Don't forget the COALESCE() tip I posted below. I tested it, and it works.

That was a great question you posted! I learned from trying to find a solution!
Hey, don't work without a PHP debugger. Several free IDEs have this features built in. Two are NetBeans and CodeLobster. Without a debugger, it's like you're driving with a blindfold on -- you are going to crash!
Reply


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



Theme © iAndrew 2016 - Forum software by © MyBB