Union Query

Discussion in 'Microsoft Access Queries' started by Guest, Apr 5, 2005.

  1. Guest

    Guest Guest

    I hope some one can help me i have this folling query and it gives me the
    correct count for Record No for the month 1 and 2 but when it does the Dcount
    for Elapse Time it gives only the count for Month 1 and for Month 2 it gives
    me the exact ones as for Month 1 and not the ones for Month 2, could sone one
    tell me what i am doing wrong

    Regards Markus

    SELECT Count([Record No]) AS [RecordNo], Dcount("[Elapse time required to
    resolve]","New All Query","[Elapse time required to resolve]='Less Then 24
    Hours'") AS [Elapsetime Less then 24 Hours]
    FROM [New All Query]
    Having (((Month([Date of Call]))=1));
    Union All SELECT Count([Record No]) AS [RecordNo], DCount("[Elapse time
    required to resolve]","New All Query","[Elapse time required to
    resolve]='Less Then 24 Hours'") AS [Elapsetime Less then 24 Hours]
    FROM [New All Query]
    Having (((Month([Date of Call]))=2));
     
    Guest, Apr 5, 2005
    #1
    1. Advertisements

  2. Guest

    Carl Rapson Guest

    You need to move your Having clause into the DCount as a WHERE clause:

    ...."[Elapse time required to resolve]='Less Then 24 Hours' AND [Date of
    Call]=1"

    and

    ...."[Elapse time required to resolve]='Less Then 24 Hours' AND [Date of
    Call]=2"

    Otherwise, nothing differentiates the two DCount calls and you'll get the
    same value for both calls.

    Carl Rapson

    "Markus" <> wrote in message
    news:...
    >I hope some one can help me i have this folling query and it gives me the
    > correct count for Record No for the month 1 and 2 but when it does the
    > Dcount
    > for Elapse Time it gives only the count for Month 1 and for Month 2 it
    > gives
    > me the exact ones as for Month 1 and not the ones for Month 2, could sone
    > one
    > tell me what i am doing wrong
    >
    > Regards Markus
    >
    > SELECT Count([Record No]) AS [RecordNo], Dcount("[Elapse time required to
    > resolve]","New All Query","[Elapse time required to resolve]='Less Then 24
    > Hours'") AS [Elapsetime Less then 24 Hours]
    > FROM [New All Query]
    > Having (((Month([Date of Call]))=1));
    > Union All SELECT Count([Record No]) AS [RecordNo], DCount("[Elapse time
    > required to resolve]","New All Query","[Elapse time required to
    > resolve]='Less Then 24 Hours'") AS [Elapsetime Less then 24 Hours]
    > FROM [New All Query]
    > Having (((Month([Date of Call]))=2));
     
    Carl Rapson, Apr 5, 2005
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Guest

    To union query or not to union query

    Guest, Feb 3, 2005, in forum: Microsoft Access Queries
    Replies:
    2
    Views:
    345
    Guest
    Feb 4, 2005
  2. Olga

    UNION or UNION ALL query question

    Olga, Apr 6, 2006, in forum: Microsoft Access Queries
    Replies:
    2
    Views:
    412
    Guest
    Apr 6, 2006
  3. Guest

    UNION vs UNION ALL

    Guest, Jul 31, 2006, in forum: Microsoft Access Queries
    Replies:
    1
    Views:
    431
    Michel Walsh
    Jul 31, 2006
  4. Phil Smith

    A union B works, A union B union C fails

    Phil Smith, Nov 28, 2006, in forum: Microsoft Access Queries
    Replies:
    2
    Views:
    523
    Phil Smith
    Nov 29, 2006
  5. kev100 via AccessMonster.com

    Can 2 Union Queries Be used in Another UNION ??

    kev100 via AccessMonster.com, Jul 30, 2007, in forum: Microsoft Access Queries
    Replies:
    2
    Views:
    239
    Guest
    Jul 30, 2007
Loading...

Share This Page