Results 1 to 12 of 12

Thread: [RESOLVED] How to design this query for monthly report?

Hybrid View

  1. #1
    Frenzied Member
    Join Date
    Jun 2014
    Posts
    1,084

    Re: How to design this query for monthly report?

    Why are you creating a problem where there is none
    both shifts start on the same day,so why not count their production as produced on that day
    (what you already seem to be doing judging by your Type DailyProduce)

    but if you want to hairsplit:
    just have the nightshift make 2 entrys(records) in the table on the last day of the month
    (1 for the last day and 1 for the first day)
    do not put off till tomorrow what you can put off forever

  2. #2
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    5,277

    Re: How to design this query for monthly report?

    Quote Originally Posted by IkkeEnGij View Post
    Why are you creating a problem where there is none
    both shifts start on the same day,so why not count their production as produced on that day
    (what you already seem to be doing judging by your Type DailyProduce)
    His Problem is, that he only has the "ending datetime" of the Shift. See my post about adding a column "starting datetime" for a shift.

    What i don't understand: Why does the nightshift count to the day prior, when 58% of the worktime belongs to the current day (5 hours for day prior, 7 hours for current day)?
    The only explanation (at least to me): The beginning of the shift determines to which day (resp. month) the produce belongs to.
    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

  3. #3
    Frenzied Member
    Join Date
    Jun 2014
    Posts
    1,084

    Re: How to design this query for monthly report?

    Quote Originally Posted by Zvoni View Post
    His Problem is, that he only has the "ending datetime" of the Shift. See my post about adding a column "starting datetime" for a shift.

    What i don't understand: Why does the nightshift count to the day prior, when 58% of the worktime belongs to the current day (5 hours for day prior, 7 hours for current day)?
    The only explanation (at least to me): The beginning of the shift determines to which day (resp. month) the produce belongs to.
    exactly, that is why s/he is creating a problem, where there is none
    it is as simple as pie:
    both shifts start at the same day
    so why not make that day the production day of both shifts ?
    and the table only needs 3 fields: Date (not datetime),DayProduction,NightProduction

    DaveDavis, is there any reason to not use such a simple system ?
    do not put off till tomorrow what you can put off forever

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2016
    Posts
    609

    Re: How to design this query for monthly report?

    Quote Originally Posted by IkkeEnGij View Post
    exactly, that is why s/he is creating a problem, where there is none
    it is as simple as pie:
    both shifts start at the same day
    so why not make that day the production day of both shifts ?
    and the table only needs 3 fields: Date (not datetime),DayProduction,NightProduction

    DaveDavis, is there any reason to not use such a simple system ?
    The data is coming from 3rd software, I can't control.

    @oumba has given a good idea by minus 7 hours.

    Thanks dilettante and PGBSoft for query design.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width