+ Reply to Thread
Page 2 of 2 FirstFirst 1 2
Results 11 to 12 of 12

Thread: Trying to get sum help

  1. #11
    Wolfmaster Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy's Avatar
    Join Date
    Mar 2008
    Location
    Peoria, IL
    Posts
    2,386
    Blog Entries
    5
    Real Name
    Wolff
    Rep Power
    15

    Why would you hard code the DistictCodes? The Group By Should be taking care of this. If you need to do more crunching on the results of the query, make this a stored query and then write another one that does the additional crunching.

    Sounds like you want to do a JOIN to the loccode table -- but I would do it after the Union query (based on what I know).

    Also, perhaps change UNION to UNION ALL, it's slightly faster. (UNION removes duplicate rows, which shouldn't be the case here).

    [edit] And I see you have repair in both queries for RecType -- prolly not what you intended.[/edit]
    Wolffy
    .-- ----- ..-. ..-. -.--
    Opinions expressed are my own and do not necessity reflect those of any sane person. Any code provided is intended to be an example and is provided AS IS. Void where prohibited by law. Not valid in California. Your mileage may vary.

  2. #12
    Barn Legend Rebelle will become famous soon enough Rebelle's Avatar
    Join Date
    Mar 2008
    Posts
    1,522
    Rep Power
    5

    Hey w0lffy,

    Ok, yes I think I would a join but I'm still not sure how this would work if I'm checking both fields for each district. I'll just enter each one into the sql syntax for now and come back to this.

    Code:
    WHERE (((qryTonyFirstTestRun2.Districtcode) Like "*OK*")) And (((qryTonyFirstTestRun2.Func_Loc_CD) Like "*OK*")) or 
    (((qryTonyFirstTestRun2.Districtcode) Like "*HD*")) And (((qryTonyFirstTestRun2.Func_Loc_CD) Like "*HD*")) or
    (((qryTonyFirstTestRun2.Districtcode) Like "*AK*")) And (((qryTonyFirstTestRun2.Func_Loc_CD) Like "*AK*"))
    
    I think I would need something to look at District code value(s) then look at the func_loc_cd to see if it matches the district code...

    Code:
    WHERE (((qryTonyFirstTestRun2.Districtcode) Like "*@@VALUE*")) And (((qryTonyFirstTestRun2.Func_Loc_CD) Like "*@@VALUE*"))
    
    Thanks so much w0lffy for getting me straight to get the results I needed... It was my first union query in access.

+ Reply to Thread
Page 2 of 2 FirstFirst 1 2

Bookmarks

Posting Permissions

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

SEO by vBSEO