Page 2 of 2 FirstFirst 12
Results 16 to 18 of 18
  1. #16
    Secureuser.cm is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2015
    Posts
    8
    the reason for 2 queries is I couldn't figure out how to provide a Top 25 negative adjusted Items by DC and Top 25 Positive Adjusted by DC in one hit. When I summed the query it added the positive and neg numbers together

  2. #17
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Try:

    SELECT * FROM table WHERE ID IN
    (SELECT TOP 5 ID FROM table AS Dupe WHERE Dupe.DC=table.DC AND [Total Cost]<0 ORDER BY Dupe.DC, Dupe.[Total Cost] ASC)
    OR ID IN
    (SELECT TOP 5 ID FROM table AS Dupe WHERE Dupe.DC=table.DC AND [Total Cost]>0 ORDER BY Dupe.DC, Dupe.[Total Cost] DESC)
    ORDER BY DC, [Total Cost] DESC;
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #18
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Well I took your zip file and extracted the sheet. I then imported the data into a table called
    Network_cc_sum_N_query_Feb.

    And it gives the results I expected.

    Code:
    ID DC Facility Item Field6 SumOfInv Adj Qty SumOfTotal Cost
    90 CR C1 969264 -936 -2686.32
    89 CR C1 843224 -100 -2719
    86 CR C1 980637 -30 -2758.8
    85 CR C1 992556 -696 -2777.04
    81 CR C1 987930 -96 -2848.608
    54 EN E2 255063 -6 -3703.86
    51 EN E2 486483 -3 -3849.75
    43 EN E1 968341 -15 -4086
    32 EN E1 992353 -47 -5449.65
    13 EN E2 105678 -102 -11285.28
    98 FL F1 991280 -120 -2561.64
    94 FL F1 966550 -600 -2628
    80 FL F1 988771 -71 -2865.56
    16 FL F1 966550 -2156 -9443.28
    92 IN I1 886519 -222 -2661.78
    59 IN I1 848834 -52 -3520.92
    14 IN I1 994599 -108 -9828
    93 LA L1 954265 -102 -2628.54
    77 LA L1 923449 -197 -2955
    69 LA L1 891018 -108 -3250.8
    68 LA L1 789829 -280 -3259.2
    45 LA L2 113179 -893 -3991.71
    76 MA M1 855600 -432 -3019.68
    57 MA M1 126988 -148 -3612.68
    38 MA M1 250978 -297 -4974.75
    37 MA M1 930082 -341 -5111.59
    97 NJ N1 822445 -170 -2585.7
    95 NJ N1 847701 -1000 -2610
    88 NJ N1 455450 -289 -2745.5
    84 NJ N1 330794 -804 -2814
    82 NJ N2 100171 -24 -2841.6
    42 OR O1 943836 -215 -4300
    73 SC S1 989617 -226 -3164
    70 SC S1 444723 -158 -3239
    67 SC S1 327812 -2579 -3275.33
    53 SC S1 871338 -171 -3760.29
    100 TN T3 961044 -2262 -2556.06
    30 TN T2 901120 -84 -5544
    96 UC U1 917862 -125 -2602.5
    61 UC U1 440673 -536 -3494.72
    17 UC U1 990147 -18 -9171.72
    11 UC U1 448445 -958 -11773.82
    83 WN W2 128989 -9 -2832.3
    74 WN W3 826105 -702 -3159
    49 WN W1 338618 -288 -3870.72
    28 WN W1 144888 -148 -5983.64
    2 WN W1 995220 -17478 -131085
    99 YK Y1 972302 -4788 -2561.58
    91 YK Y1 973788 -312 -2664.48
    87 YK Y1 927377 -426 -2758.35
    78 YK Y1 304730 -71 -2881.18
    65 YK Y1 789994 -671 -3408.68

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. How to save results from a filter into a table
    By jmmunoz2141 in forum Access
    Replies: 2
    Last Post: 03-04-2014, 09:09 AM
  2. Using a query to filter - too many results
    By pbouk in forum Queries
    Replies: 9
    Last Post: 03-14-2013, 11:26 AM
  3. Replies: 1
    Last Post: 08-16-2012, 01:51 PM
  4. Look Up Tables and Filter Results
    By starkeymd in forum Access
    Replies: 1
    Last Post: 01-12-2012, 04:17 PM
  5. cbo to filter results from a query
    By nianko in forum Forms
    Replies: 5
    Last Post: 08-18-2010, 09:43 AM

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
  •  
Other Forums: Microsoft Office Forums