Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Query

Discussion in 'Information Technology' started by GLO, Jul 28, 2006.

Tags:
  1. GLO

    GLO
    Expand Collapse
    Guest

    I have the following fields in my database:
    SKU Number, Date, Shift/Team, Finished Units, Defects

    I need to create a query that sums the # of finished units and defects by
    SKU Number, Date, and Shift/Team. The problem I have run into is that the
    graveyard shift goes over multiple dates since it runs from 6pm-6am. How do
    I sum the finished units and defects for a given shift when there will be
    multiple results for a shift in a day and the shift goes over two dates. For
    example:

    SKU # Date Shift/Team Finished Units Defects
    1 1/1/06 A Gyd 20 200
    1 1/1/06 A Gyd 10 150
    1 1/2/06 A Gyd 15 100
    2 1/2/06 A Gyd 10 50
    1 1/2/06 A Day 25 300
    5 1/2/06 A Day 10 25
    1 1/2/06 A Gyd 15 100

    How would I ensure the query sums the first three lines, but doesn't include
    the 7th line?
     
  2. Loading...

    Similar Threads Forum Date
    Query about Jhatka Meat by Shooting in Head Sikh Sikhi Sikhism Aug 26, 2011
    Who is a sikh? A non sikh friend's query!! Sikh Sikhi Sikhism Apr 30, 2010
    General Query Hard Talk Sep 4, 2008
    Power of pauri's in Japji Sahib query Sikh Sikhi Sikhism Aug 17, 2006
    Sikhism a query Book Reviews & Editorials Aug 2, 2005

  3. KARL DEWEY

    KARL DEWEY
    Expand Collapse
    Guest

    You need to add time with your date so you can distingush between the "A Gyd
    " entries. Default your table with Now() to include time.

    "GLO" wrote:

    > I have the following fields in my database:
    > SKU Number, Date, Shift/Team, Finished Units, Defects
    >
    > I need to create a query that sums the # of finished units and defects by
    > SKU Number, Date, and Shift/Team. The problem I have run into is that the
    > graveyard shift goes over multiple dates since it runs from 6pm-6am. How do
    > I sum the finished units and defects for a given shift when there will be
    > multiple results for a shift in a day and the shift goes over two dates. For
    > example:
    >
    > SKU # Date Shift/Team Finished Units Defects
    > 1 1/1/06 A Gyd 20 200
    > 1 1/1/06 A Gyd 10 150
    > 1 1/2/06 A Gyd 15 100
    > 2 1/2/06 A Gyd 10 50
    > 1 1/2/06 A Day 25 300
    > 5 1/2/06 A Day 10 25
    > 1 1/2/06 A Gyd 15 100
    >
    > How would I ensure the query sums the first three lines, but doesn't include
    > the 7th line?
     
  4. GLO

    GLO
    Expand Collapse
    Guest

    I have tried that but I still don't know how to get the query to sum all of
    the entries for two different dates.

    "KARL DEWEY" wrote:

    > You need to add time with your date so you can distingush between the "A Gyd
    > " entries. Default your table with Now() to include time.
    >
    > "GLO" wrote:
    >
    > > I have the following fields in my database:
    > > SKU Number, Date, Shift/Team, Finished Units, Defects
    > >
    > > I need to create a query that sums the # of finished units and defects by
    > > SKU Number, Date, and Shift/Team. The problem I have run into is that the
    > > graveyard shift goes over multiple dates since it runs from 6pm-6am. How do
    > > I sum the finished units and defects for a given shift when there will be
    > > multiple results for a shift in a day and the shift goes over two dates. For
    > > example:
    > >
    > > SKU # Date Shift/Team Finished Units Defects
    > > 1 1/1/06 A Gyd 20 200
    > > 1 1/1/06 A Gyd 10 150
    > > 1 1/2/06 A Gyd 15 100
    > > 2 1/2/06 A Gyd 10 50
    > > 1 1/2/06 A Day 25 300
    > > 5 1/2/06 A Day 10 25
    > > 1 1/2/06 A Gyd 15 100
    > >
    > > How would I ensure the query sums the first three lines, but doesn't include
    > > the 7th line?
     
  5. KARL DEWEY

    KARL DEWEY
    Expand Collapse
    Guest

    Try this --
    Day shift Between [Enter start date]+0.25 And [Enter start date]+0.75
    Grave shift Between [Enter start date]+0.750001 And [Enter start date]+1.25


    "GLO" wrote:

    > I have tried that but I still don't know how to get the query to sum all of
    > the entries for two different dates.
    >
    > "KARL DEWEY" wrote:
    >
    > > You need to add time with your date so you can distingush between the "A Gyd
    > > " entries. Default your table with Now() to include time.
    > >
    > > "GLO" wrote:
    > >
    > > > I have the following fields in my database:
    > > > SKU Number, Date, Shift/Team, Finished Units, Defects
    > > >
    > > > I need to create a query that sums the # of finished units and defects by
    > > > SKU Number, Date, and Shift/Team. The problem I have run into is that the
    > > > graveyard shift goes over multiple dates since it runs from 6pm-6am. How do
    > > > I sum the finished units and defects for a given shift when there will be
    > > > multiple results for a shift in a day and the shift goes over two dates. For
    > > > example:
    > > >
    > > > SKU # Date Shift/Team Finished Units Defects
    > > > 1 1/1/06 A Gyd 20 200
    > > > 1 1/1/06 A Gyd 10 150
    > > > 1 1/2/06 A Gyd 15 100
    > > > 2 1/2/06 A Gyd 10 50
    > > > 1 1/2/06 A Day 25 300
    > > > 5 1/2/06 A Day 10 25
    > > > 1 1/2/06 A Gyd 15 100
    > > >
    > > > How would I ensure the query sums the first three lines, but doesn't include
    > > > the 7th line?
     

Share This Page