User Profile

Collapse

Profile Sidebar

Collapse
KaliKraft
KaliKraft
Last Activity: Feb 12 '08, 11:03 PM
Joined: Nov 9 '07
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • WRENCH #3

    Than you for all your help so far but now i would like to get these types of results.

    Sample Data:


    Results:
    Code:
    4, 22.00, null,  '2007-10-10'
    4, 7.00,  null,  '2007-10-12'
    5, null,  23.50, '2007-10-10'
    6, 6.35,  13.42, '2007-10-12'
    I get the sample data by using this select:

    [code=sql]
    select fldDriverHours, fldDriverID,...
    See more | Go to post

    Leave a comment:


  • This is what I came up with:

    [code=mysql]
    SELECT a.empid employee, driving, helping
    FROM (SELECT empid,fldTicket ID, sum(driver_hrs) driving FROM emp LEFT OUTER JOIN work on empid=driver GROUP BY empid) a JOIN
    (SELECT empid,fldTicket ID, sum(helper_hrs) helping FROM emp LEFT OUTER JOIN work on empid=helper GROUP BY empid) b on a.empid=b.empid
    inner join tblTicket t on a.fldTicketID...
    See more | Go to post
    Last edited by KaliKraft; Nov 20 '07, 04:57 PM. Reason: Premaute Posting :P

    Leave a comment:


  • Thank you it works great.

    Now I need to add a wrench.

    I have to filter it using a date range like my first post. On the "work" table there is a date that i need to filter by. Either for a date or a date range or for a year.

    Hopefully i can edit it. I will reply if i have any issues.

    Thank you,
    Jordon...
    See more | Go to post

    Leave a comment:


  • I have tried a few more things and now I have a select that returns all the hours for all the employees.

    Code:
    select w.fldDriverHours, w.flddriverid, w.fldHelperHours, w.fldHelperid,t.flddate
    From tblTicket t inner join tblWork w on w.fldTicketID = t.fldTicketID
    where fldDate >= '2007-10-10' AND fldDate <= '2007-10-13'
    I get these results:

    Code:
    15.00, 4, 15.00, 5, '2007-10-10'
    ...
    See more | Go to post
    Last edited by KaliKraft; Nov 16 '07, 11:10 PM. Reason: Added expected results

    Leave a comment:


  • **Sorry for late reply, i didn't get notified by email**



    No My query is only giving the results of the employee of the ID that I send in as a parameter.



    I can't do that. See a employeeId is linked to a DriverID or a HelperID or both.

    The result i get from a join are way wrong.

    I will include the table structure:

    tblEmployee
    - fldEmployeeID...
    See more | Go to post

    Leave a comment:


  • I edited my original post with what i have so far.

    Currently I am doing the select shown over and over again for each employee (takes time, especially once they do it for 30+ employees), I would like to get it as one select with the results.

    Thanks,
    Jordon...
    See more | Go to post

    Leave a comment:


  • KaliKraft
    started a topic Select Sum on two fields using 2 key fields

    Select Sum on two fields using 2 key fields

    I have a tblWork that has a dozen fields in it.
    It tracks hours worked for 2 employees at a time.
    - fldDriverID
    - fldDriverHours
    - fldHelperID
    - fldHelperHours

    It also has a date field (fldDate) and a key to the ticket the work was performed on (fldTicketID).

    So I assign the driver and the hours worked (1,15h) same for helper (1,13h)

    What i want to do is do a payroll...
    See more | Go to post
    Last edited by mwasif; Nov 9 '07, 04:50 PM. Reason: Formatted query
No activity results to display
Show More
Working...