SOLVED

Finding Multiple Values

%3CLINGO-SUB%20id%3D%22lingo-sub-1133830%22%20slang%3D%22en-US%22%3EFinding%20Multiple%20Values%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1133830%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20a%20table%20that%20has%20thousands%20of%20rows%20in%20it.%20I%20need%20to%20write%20a%20query%20to%20pull%20out%20lines%20where%20a%20person%20is%20serving%20more%20than%20one%20function.%26nbsp%3B%20%26nbsp%3BBelow%20in%20my%20example%20I%20want%20Micky%20below%20to%20appear%20in%20my%20query%20because%20he%20has%20multiple%20functions.%26nbsp%3B%20Minnie%20would%20not%20appear%20because%20she%20has%20the%20same%20function%20the%20whole%20time.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EExample%3A%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CTABLE%3E%3CTBODY%3E%3CTR%3E%3CTD%3EID%3C%2FTD%3E%3CTD%3EFirst%3C%2FTD%3E%3CTD%3ELast%3C%2FTD%3E%3CTD%3EDate%3C%2FTD%3E%3CTD%3EAmount%3C%2FTD%3E%3CTD%3EFunction%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E12833%3C%2FTD%3E%3CTD%3EMicky%3C%2FTD%3E%3CTD%3EMouse%3C%2FTD%3E%3CTD%3E07%2F26%2F19%3C%2FTD%3E%3CTD%3E1%2C219%3C%2FTD%3E%3CTD%3E226%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E12833%3C%2FTD%3E%3CTD%3EMicky%3C%2FTD%3E%3CTD%3EMouse%3C%2FTD%3E%3CTD%3E07%2F12%2F19%3C%2FTD%3E%3CTD%3E1%2C219%3C%2FTD%3E%3CTD%3E227%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E12833%3C%2FTD%3E%3CTD%3EMicky%3C%2FTD%3E%3CTD%3EMouse%3C%2FTD%3E%3CTD%3E09%2F20%2F19%3C%2FTD%3E%3CTD%3E1%2C219%3C%2FTD%3E%3CTD%3E228%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E56025%3C%2FTD%3E%3CTD%3EMinnie%3C%2FTD%3E%3CTD%3EMouse%3C%2FTD%3E%3CTD%3E08%2F23%2F19%3C%2FTD%3E%3CTD%3E1%2C219%3C%2FTD%3E%3CTD%3E226%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E56025%3C%2FTD%3E%3CTD%3EMinnie%3C%2FTD%3E%3CTD%3EMouse%3C%2FTD%3E%3CTD%3E09%2F06%2F19%3C%2FTD%3E%3CTD%3E1%2C219%3C%2FTD%3E%3CTD%3E226%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E56025%3C%2FTD%3E%3CTD%3EMinnie%3C%2FTD%3E%3CTD%3EMouse%3C%2FTD%3E%3CTD%3E08%2F09%2F19%3C%2FTD%3E%3CTD%3E1%2C219%3C%2FTD%3E%3CTD%3E226%3C%2FTD%3E%3C%2FTR%3E%3C%2FTBODY%3E%3C%2FTABLE%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1133830%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAccess%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1137533%22%20slang%3D%22en-US%22%3ERe%3A%20Finding%20Multiple%20Values%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1137533%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F512534%22%20target%3D%22_blank%22%3E%40DataComplianceNerd%3C%2FA%3E%26nbsp%3B%3CBR%20%2F%3E%3CBR%20%2F%3EYou%20can%20do%20this%20with%20two%20queries.%3C%2FP%3E%3CP%3Ethe%20first%20will%20group%20People%20by%20jobs%2C%20so%20you%20get%20one%20row%20per%20person%20per%20job.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESELECT%20Table1.FirstName%2C%20Table1.LastName%2C%20Table1.JobFunction%3CBR%20%2F%3EFROM%20Table1%3CBR%20%2F%3EGROUP%20BY%20Table1.FirstName%2C%20Table1.LastName%2C%20Table1.JobFunction%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESave%20that%20as%20%22DistinctJobFunctions%22%20and%20use%20this%20query%20in%20a%20second%20one.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESELECT%20DistinctJobFunctions.FirstName%2C%20DistinctJobFunctions.LastName%2C%20Count(DistinctJobFunctions.JobFunction)%20AS%20CountOfJobFunction%3CBR%20%2F%3EFROM%20DistinctJobFunctions%3CBR%20%2F%3EGROUP%20BY%20DistinctJobFunctions.FirstName%2C%20DistinctJobFunctions.LastName%3CBR%20%2F%3EHAVING%20(((Count(DistinctJobFunctions.JobFunction))%26gt%3B1))%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1137950%22%20slang%3D%22en-US%22%3ERE%3A%20Finding%20Multiple%20Values%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1137950%22%20slang%3D%22en-US%22%3EThank%20you%20for%20your%20help%2C%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F126074%22%20target%3D%22_blank%22%3E%40George%20Hepworth%3C%2FA%3E.%20I%20followed%20your%20instructions%20and%20everything%20is%20working%20as%20expected%2C%20except%20when%20I%20try%20to%20run%20the%20second%20query.%20I%20am%20getting%20an%20error%20message%20of%3A%20The%20LEVEL%20clause%20includes%20a%20work%20or%20argument%20that%20is%20misspelled%20or%20missing.%22%20It%20doesn't%20like%20the%20HAVING%20as%20it%20appears%20on%20a%20list%20of%20reserved%20words%20for%20Access.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1137990%22%20slang%3D%22en-US%22%3ERE%3A%20Finding%20Multiple%20Values%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1137990%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F512534%22%20target%3D%22_blank%22%3E%40DataComplianceNerd%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%22LEVEL%20clause%22%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHAVING%20is%20indeed%20a%20reserved%20word%20in%20SQL%2C%20it%20is%20a%20way%20to%20say%2C%20in%20lay%20terms%20%22only%20include%20records%20which%20meet%20this%20criteria%22%2C%20i.e.%20records%20%22HAVING%20this%20criteria.%22%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECan%20you%20provide%20the%20two%20SQL%20statements%20from%20your%20two%20queries%3F%20Maybe%20someone%20can%20spot%20something%20to%20help.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1138110%22%20slang%3D%22en-US%22%3ERE%3A%20Finding%20Multiple%20Values%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1138110%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F126074%22%20target%3D%22_blank%22%3E%40George%20Hepworth%3C%2FA%3E%26nbsp%3Bhere%20is%20what%20I%20am%20using%3A%3C%2FP%3E%3CP%3EQuery%201%3A%26nbsp%3B%3C%2FP%3E%3CP%3ESELECT%20Payroll.ID%2C%20Payroll.%5BPay%20Run%5D%2C%20Payroll.FCode%3CBR%20%2F%3EFROM%20Payroll%3CBR%20%2F%3EGROUP%20BY%20Payroll.ID%2C%20Payroll.%5BPay%20Run%5D%2C%20Payroll.FCode%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EQuery%202%3A%26nbsp%3B%3C%2FP%3E%3CP%3ESELECT%20DistinctJobFunctions.ID%2C%20DistinctJobFunctions.%5BPay%20Run%5D%2C%20DistinctJobFunctions.FCode%3CBR%20%2F%3EFROM%20DistinctJobFunctions%3B%3CBR%20%2F%3EGROUP%20BY%20DistinctJobFunctions.Pay_Run%2C%20DistinctJobFunctions.ID%3CBR%20%2F%3EHAVING%20(((Count(DistinctJobFunctions.FCode))%26gt%3B1))%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20get%20the%20error%20when%20running%20the%20second%20query%20and%20after%20I%20close%20the%20error%2C%20it%20highlights%20the%20word%20HAVING.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20for%20all%20your%20help.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1138306%22%20slang%3D%22en-US%22%3ERE%3A%20Finding%20Multiple%20Values%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1138306%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F512534%22%20target%3D%22_blank%22%3E%40DataComplianceNerd%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20Payroll.ID%20is%20the%20primary%20key%20for%20the%20table%20called%20Payroll%2C%20this%20can't%20work.%20The%20first%20query%20will%20return%20one%20record%20for%20each%20ID%2C%20not%20for%20each%20person%20(and%20I%20don't%20even%20see%20Person%20first%20names%20and%20last%20names%20here).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1138323%22%20slang%3D%22en-US%22%3ERE%3A%20Finding%20Multiple%20Values%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1138323%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F512534%22%20target%3D%22_blank%22%3E%40DataComplianceNerd%3C%2FA%3EThe%20group%20by%20should%20include%20each%20of%20the%20fields%20selected%20in%20the%20Select%20clause.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1138344%22%20slang%3D%22en-US%22%3ERE%3A%20Finding%20Multiple%20Values%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1138344%22%20slang%3D%22en-US%22%3EThanks%2C%20I%20missed%20one.%3CBR%20%2F%3E%3CBR%20%2F%3EI%20saw%20your%20other%20post%20about%20ID%20being%20the%20primary%20key%2C%20and%20it%20is%20not.%20My%20ID%20field%20is%20their%20employee%20number%20as%20my%20identifier.%20Each%20line%20in%20my%20payroll%20table%20has%20an%20identifying%20record%20number%20that%20is%20auto%20sequenced.%20Each%20employee%20could%20have%20anywhere%20from%202-6%20lines%20per%20pay%20period%20depending%20on%20their%20function.%3CBR%20%2F%3E%3CBR%20%2F%3EI%20just%20need%20to%20figure%20out%20a%20way%20to%20determine%20those%20that%20are%20doing%20multiple%20functions.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1138391%22%20slang%3D%22en-US%22%3ERE%3A%20Finding%20Multiple%20Values%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1138391%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F512534%22%20target%3D%22_blank%22%3E%40DataComplianceNerd%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%22%20Each%20line%20in%20my%20payroll%20table%20has%20an%20identifying%20record%20number%20that%20is%20auto%20sequenced.%22%3C%2FP%3E%3CP%3EIf%20they%20are%20unique%2C%20even%20though%20they%20are%20not%20Primary%20Keys%2C%20including%20them%20will%20force%20one%20record%20for%20each%2C%20so%20that%20means%20it%20can't%20be%20included.%20Use%20the%20employee's%20ID%2C%20or%20Employee%20Number%2C%20so%20that%20you%20get%20one%20record%20per%20employee.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOnce%20you%20get%20how%20the%20Group%20By%20works%2C%20it'll%20be%20totally%20obvious%2C%20but%20it%20can%20be%20a%20bit%20opaque%20at%20first.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1139666%22%20slang%3D%22en-US%22%3ERE%3A%20Finding%20Multiple%20Values%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1139666%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F126074%22%20target%3D%22_blank%22%3E%40George%20Hepworth%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHere%20is%20the%20setup%20for%20my%20Payroll%20Table%3A%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F168054i037706E64AF73E08%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20alt%3D%22clipboard_image_0.png%22%20title%3D%22clipboard_image_0.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EI%20load%20an%20Excel%20file%20I%20get%20from%20my%20accounting%20department%20each%20week.%20the%20highlighted%20fields%20are%20lookups%20to%20other%20tables%20in%20my%20database.%26nbsp%3B%20ID%20is%20linked%20to%20my%20Employee%20file%20where%20ID%20is%20my%20primary%20key%20and%20one%20line%20per%20employee.%26nbsp%3B%20My%20payroll%20table%20has%20thousands%20of%20lines%20in%20it%20and%20just%20keeps%20growing%20each%20week%20when%20I%20get%20a%20new%20file.%26nbsp%3B%20My%20ultimate%20goal%20is%20to%20create%20a%20report%20of%20those%20that%20have%20more%20than%20one%20Function%20Code%20for%20a%20range%20of%20pay%20dates.%20An%20employee%20may%20have%20multiple%20Pay%20Codes%2C%20but%20under%20the%20same%20function.%26nbsp%3B%20I%20need%20the%20ones%20that%20have%20multiple%20functions%20as%20well.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDoes%20this%20make%20sense%3F%26nbsp%3B%20I%20have%20been%20racking%20my%20brain%20on%20how%20to%20make%20this%20work%20and%20just%20can't%20get%20it.....%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1139736%22%20slang%3D%22en-US%22%3ERE%3A%20Finding%20Multiple%20Values%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1139736%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F512534%22%20target%3D%22_blank%22%3E%40DataComplianceNerd%3C%2FA%3EMy%20bad.%20I%20misunderstood.%20%22ID%22%20here%20is%20a%20Foreign%20Key%20to%20the%20employee%20table.%20In%20that%20case%20it%20would%20not%20be%20unique%20for%20each%20payroll%20record.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThat%20said%2C%20you've%20add%20an%20additional%20criteria%20or%20two%20to%20that%20posted%20initially%2C%20I%20think%3A%3C%2FP%3E%3CP%3E%22%20My%20ultimate%20goal%20is%20to%20create%20a%20report%20of%20those%20that%20have%20more%20than%20one%20Function%20Code%20for%20a%20range%20of%20pay%20dates.%20An%20employee%20may%20have%20multiple%20Pay%20Codes%2C%20but%20under%20the%20same%20function.%20I%20need%20the%20ones%20that%20have%20multiple%20functions%20as%20well.%20%22%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESo%2C%20it%20needs%20to%20be%20by%20Pay%20Date%20range%2C%20by%20Pay%20Codes%2C%20by%20Functions.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERight%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1139849%22%20slang%3D%22en-US%22%3ERE%3A%20Finding%20Multiple%20Values%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1139849%22%20slang%3D%22en-US%22%3E%3CP%3ESorry%20for%20the%20confusion.%20I%20don't%20necessarily%20care%20about%20the%20pay%20codes%2C%20just%20the%20functions.%20When%20I%20run%20the%20report%20I%20need%20anyone%20with%20more%20than%20one%20function%20anywhere%20within%20the%20specified%20date%20range.%20So%20if%20I%20select%20July%201%20-%20August%2030%2C%20I%20need%20a%20list%20of%20people%20to%20be%20created%20that%20have%20more%20than%20one%20function%20code.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1139881%22%20slang%3D%22en-US%22%3ERE%3A%20Finding%20Multiple%20Values%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1139881%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F512534%22%20target%3D%22_blank%22%3E%40DataComplianceNerd%3C%2FA%3E%26nbsp%3B%20No%20problem.%20I'll%20see%20what%20I%20can%20do%20with%20that%20expanded%20table%2C%20but%20it%20would%20be%20helpful%20to%20have%20some%20REAL%20sample%20data%20to%20work%20with%2C%20not%20the%20kind%20of%20%22over-simplified%22%20data%20in%20the%20first%20post.%20Sometimes%20it%20does%20happen%20that%20trying%20to%20simplify%20actually%20is%20counter-productive%20because%20it%20masks%20real%20factors.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1139910%22%20slang%3D%22en-US%22%3ERE%3A%20Finding%20Multiple%20Values%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1139910%22%20slang%3D%22en-US%22%3E%3CP%3EI%20apologize%20for%20sending%20this%20in%20the%20wrong%20direction%2C%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F126074%22%20target%3D%22_blank%22%3E%40George%20Hepworth%3C%2FA%3E.%26nbsp%3B%20Here%20is%20some%20actual%20data%20from%20my%20payroll%20table%20that%20I%20am%20working%20with.%26nbsp%3B%20I%20would%20need%20employee%2010567%20to%20show%20up%20in%20my%20list%20because%20he%20has%20functions%20215%20%26amp%3B%20221.%26nbsp%3B%20I%20would%20not%20want%2022301%20to%20show%20up%20because%20they%20are%20only%20function%20125%20all%20the%20time.%26nbsp%3B%20Does%20this%20make%20more%20sense%20of%20what%20I%20need%3F%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CTABLE%3E%3CTBODY%3E%3CTR%3E%3CTD%3ERecord%20Number%3C%2FTD%3E%3CTD%3EID%3C%2FTD%3E%3CTD%3EPay%20Run%3C%2FTD%3E%3CTD%3EPay%20Date%3C%2FTD%3E%3CTD%3EPay%20Code%3C%2FTD%3E%3CTD%3EPay%20Code%20Description%3C%2FTD%3E%3CTD%3EAmount%3C%2FTD%3E%3CTD%3EASN%3C%2FTD%3E%3CTD%3EAccount%20%23%3C%2FTD%3E%3CTD%3EFCode%3C%2FTD%3E%3CTD%3EBuilding%3C%2FTD%3E%3CTD%3EDept%3C%2FTD%3E%3CTD%3EObject%20Code%3C%2FTD%3E%3CTD%3EGrant%20%23%3C%2FTD%3E%3CTD%3EPercent%20Distributed%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E70%3C%2FTD%3E%3CTD%3E10567%3C%2FTD%3E%3CTD%3E299%3C%2FTD%3E%3CTD%3E20-Sep-19%3C%2FTD%3E%3CTD%3E1%3C%2FTD%3E%3CTD%3E%26nbsp%3B%3C%2FTD%3E%3CTD%3E%24841.77%3C%2FTD%3E%3CTD%3E%26nbsp%3B%3C%2FTD%3E%3CTD%3E128%3C%2FTD%3E%3CTD%3E215%3C%2FTD%3E%3CTD%3E7%3C%2FTD%3E%3CTD%3E490%3C%2FTD%3E%3CTD%3E1280%3C%2FTD%3E%3CTD%3E0%3C%2FTD%3E%3CTD%3E1%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E71%3C%2FTD%3E%3CTD%3E10567%3C%2FTD%3E%3CTD%3E291%3C%2FTD%3E%3CTD%3E26-Jul-19%3C%2FTD%3E%3CTD%3E424%3C%2FTD%3E%3CTD%3E%26nbsp%3B%3C%2FTD%3E%3CTD%3E%24382.00%3C%2FTD%3E%3CTD%3E%26nbsp%3B%3C%2FTD%3E%3CTD%3E199%3C%2FTD%3E%3CTD%3E221%3C%2FTD%3E%3CTD%3E66%3C%2FTD%3E%3CTD%3E0%3C%2FTD%3E%3CTD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C%2FTD%3E%3CTD%3E%26nbsp%3B%3C%2FTD%3E%3CTD%3E%24382.00%3C%2FTD%3E%3CTD%3E%26nbsp%3B%3C%2FTD%3E%3CTD%3E199%3C%2FTD%3E%3CTD%3E221%3C%2FTD%3E%3CTD%3E66%3C%2FTD%3E%3CTD%3E0%3C%2FTD%3E%3CTD%3E1990%3C%2FTD%3E%3CTD%3E1618%3C%2FTD%3E%3CTD%3E%26nbsp%3B%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E90%3C%2FTD%3E%3CTD%3E73001%3C%2FTD%3E%3CTD%3E291%3C%2FTD%3E%3CTD%3E26-Jul-19%3C%2FTD%3E%3CTD%3E424%3C%2FTD%3E%3CTD%3E%26nbsp%3B%3C%2FTD%3E%3CTD%3E%24418.00%3C%2FTD%3E%3CTD%3E%26nbsp%3B%3C%2FTD%3E%3CTD%3E199%3C%2FTD%3E%3CTD%3E221%3C%2FTD%3E%3CTD%3E66%3C%2FTD%3E%3CTD%3E0%3C%2FTD%3E%3CTD%3E1990%3C%2FTD%3E%3CTD%3E1609%3C%2FTD%3E%3CTD%3E%26nbsp%3B%3C%2FTD%3E%3C%2FTR%3E%3C%2FTBODY%3E%3C%2FTABLE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1139974%22%20slang%3D%22en-US%22%3ERE%3A%20Finding%20Multiple%20Values%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1139974%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F512534%22%20target%3D%22_blank%22%3E%40DataComplianceNerd%3C%2FA%3EGive%20me%20a%20few%20minutes%20to%20work%20this%20over.%20Thanks.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1140072%22%20slang%3D%22en-US%22%3ERE%3A%20Finding%20Multiple%20Values%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1140072%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F126074%22%20target%3D%22_blank%22%3E%40George%20Hepworth%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBased%20on%20this%20sample%20data%2C%20these%20queries%20return%20three%20employee%20IDs%20with%202%20(or%20more)%20Function%20Codes%20within%20the%20range%20of%20the%20data.%20To%20apply%20date%20range%20filtering%2C%20you%20can%20join%20this%20query%20back%20to%20the%20payroll%20data%20and%20filter%20it%20on%20date.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESELECT%20Payrolldata.ID%2C%20Payrolldata.FunctionCode%3CBR%20%2F%3EFROM%20Payrolldata%3CBR%20%2F%3EGROUP%20BY%20Payrolldata.ID%2C%20Payrolldata.FunctionCode%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESave%20this%20as%20UniqueEmployeeFunctionCodes%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EUse%20it%20in%20this%20query.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESELECT%20UniqueEmployeeFunctionCodes.ID%2C%20Count(UniqueEmployeeFunctionCodes.FunctionCode)%20AS%20MultipleFunctionCodes%3CBR%20%2F%3EFROM%20UniqueEmployeeFunctionCodes%3CBR%20%2F%3EGROUP%20BY%20UniqueEmployeeFunctionCodes.ID%3CBR%20%2F%3EHAVING%20(((Count(UniqueEmployeeFunctionCodes.FunctionCode))%26gt%3B1))%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1140999%22%20slang%3D%22en-US%22%3ERE%3A%20Finding%20Multiple%20Values%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1140999%22%20slang%3D%22en-US%22%3EYou%20are%20AMAZING!!!%20That%20is%20exactly%20what%20I%20needed.%20THANK%20YOU%20Soooooo%20much!!!!%20I%20appreciate%20your%20help.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1141259%22%20slang%3D%22en-US%22%3ERE%3A%20Finding%20Multiple%20Values%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1141259%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F512534%22%20target%3D%22_blank%22%3E%40DataComplianceNerd%3C%2FA%3E%26nbsp%3B%20Congratulations%20on%20finding%20a%20solution%20to%20the%20problem.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EContinued%20success%20with%20the%20project.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESorry%20it%20took%20so%20long%20to%20work%20out.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional Contributor

I have a table that has thousands of rows in it. I need to write a query to pull out lines where a person is serving more than one function.   Below in my example I want Micky below to appear in my query because he has multiple functions.  Minnie would not appear because she has the same function the whole time. 

 

Example: 

 

IDFirstLastDateAmountFunction
12833MickyMouse07/26/191,219226
12833MickyMouse07/12/191,219227
12833MickyMouse09/20/191,219228
56025MinnieMouse08/23/191,219226
56025MinnieMouse09/06/191,219226
56025MinnieMouse08/09/191,219226
16 Replies
Highlighted

@DataComplianceNerd 

You can do this with two queries.

the first will group People by jobs, so you get one row per person per job.

 

SELECT Table1.FirstName, Table1.LastName, Table1.JobFunction
FROM Table1
GROUP BY Table1.FirstName, Table1.LastName, Table1.JobFunction;

 

Save that as "DistinctJobFunctions" and use this query in a second one.

 

SELECT DistinctJobFunctions.FirstName, DistinctJobFunctions.LastName, Count(DistinctJobFunctions.JobFunction) AS CountOfJobFunction
FROM DistinctJobFunctions
GROUP BY DistinctJobFunctions.FirstName, DistinctJobFunctions.LastName
HAVING (((Count(DistinctJobFunctions.JobFunction))>1));

Highlighted
Thank you for your help, @George Hepworth. I followed your instructions and everything is working as expected, except when I try to run the second query. I am getting an error message of: The LEVEL clause includes a work or argument that is misspelled or missing." It doesn't like the HAVING as it appears on a list of reserved words for Access.
Highlighted

@DataComplianceNerd 

 

"LEVEL clause"?

 

HAVING is indeed a reserved word in SQL, it is a way to say, in lay terms "only include records which meet this criteria", i.e. records "HAVING this criteria."

 

Can you provide the two SQL statements from your two queries? Maybe someone can spot something to help.

 

Highlighted

@George Hepworth here is what I am using:

Query 1: 

SELECT Payroll.ID, Payroll.[Pay Run], Payroll.FCode
FROM Payroll
GROUP BY Payroll.ID, Payroll.[Pay Run], Payroll.FCode;

 

Query 2: 

SELECT DistinctJobFunctions.ID, DistinctJobFunctions.[Pay Run], DistinctJobFunctions.FCode
FROM DistinctJobFunctions;
GROUP BY DistinctJobFunctions.Pay_Run, DistinctJobFunctions.ID
HAVING (((Count(DistinctJobFunctions.FCode))>1));

 

I get the error when running the second query and after I close the error, it highlights the word HAVING.  

 

Thanks for all your help. 

Highlighted

@DataComplianceNerdThe group by should include each of the fields selected in the Select clause.

Highlighted
Thanks, I missed one.

I saw your other post about ID being the primary key, and it is not. My ID field is their employee number as my identifier. Each line in my payroll table has an identifying record number that is auto sequenced. Each employee could have anywhere from 2-6 lines per pay period depending on their function.

I just need to figure out a way to determine those that are doing multiple functions.
Highlighted

@DataComplianceNerd 

" Each line in my payroll table has an identifying record number that is auto sequenced."

If they are unique, even though they are not Primary Keys, including them will force one record for each, so that means it can't be included. Use the employee's ID, or Employee Number, so that you get one record per employee.

 

Once you get how the Group By works, it'll be totally obvious, but it can be a bit opaque at first.

Highlighted

@George Hepworth 

 

Here is the setup for my Payroll Table: 

clipboard_image_0.png

I load an Excel file I get from my accounting department each week. the highlighted fields are lookups to other tables in my database.  ID is linked to my Employee file where ID is my primary key and one line per employee.  My payroll table has thousands of lines in it and just keeps growing each week when I get a new file.  My ultimate goal is to create a report of those that have more than one Function Code for a range of pay dates. An employee may have multiple Pay Codes, but under the same function.  I need the ones that have multiple functions as well. 

 

Does this make sense?  I have been racking my brain on how to make this work and just can't get it.....

Highlighted

@DataComplianceNerdMy bad. I misunderstood. "ID" here is a Foreign Key to the employee table. In that case it would not be unique for each payroll record.

 

That said, you've add an additional criteria or two to that posted initially, I think:

" My ultimate goal is to create a report of those that have more than one Function Code for a range of pay dates. An employee may have multiple Pay Codes, but under the same function. I need the ones that have multiple functions as well. "

 

So, it needs to be by Pay Date range, by Pay Codes, by Functions.

 

Right?

 

 

Highlighted

Sorry for the confusion. I don't necessarily care about the pay codes, just the functions. When I run the report I need anyone with more than one function anywhere within the specified date range. So if I select July 1 - August 30, I need a list of people to be created that have more than one function code. 

Highlighted

@DataComplianceNerd  No problem. I'll see what I can do with that expanded table, but it would be helpful to have some REAL sample data to work with, not the kind of "over-simplified" data in the first post. Sometimes it does happen that trying to simplify actually is counter-productive because it masks real factors.

Highlighted

I apologize for sending this in the wrong direction, @George Hepworth.  Here is some actual data from my payroll table that I am working with.  I would need employee 10567 to show up in my list because he has functions 215 & 221.  I would not want 22301 to show up because they are only function 125 all the time.  Does this make more sense of what I need? 

 

Record NumberIDPay RunPay DatePay CodePay Code DescriptionAmountASNAccount #FCodeBuildingDeptObject CodeGrant #Percent Distributed
701056729920-Sep-191 $841.77 1282157490128001
711056729126-Jul-19424 $382.00 19922166019901618 
721056729126-Jul-19424 $418.00 19922166019901609 
732230129920-Sep-191 $942.27 1631258016301009 
742230129706-Sep-191 $942.27 1631258016301009 
756231029920-Sep-191 $225.38 124513130124001
766231029920-Sep-191 $225.38 124513130124001
776231029706-Sep-191 $225.38 124513130124001
786231029706-Sep-191 $225.38 124513130124001
796231029706-Sep-19200 $182.98 19422113019401519 
806231029126-Jul-19424 $382.00 19922166019901618 
816231029126-Jul-19424 $418.00 19922166019901609 
826231028912-Jul-19236 $392.10 19222166019201609 
837300129920-Sep-191 $225.38 124513740124001
847300129920-Sep-191 $225.38 124513740124001
857300129920-Sep-191 $225.38 124513740124001
867300129706-Sep-191 $225.38 124513740124001
877300129706-Sep-191 $225.38 124513740124001
887300129706-Sep-191 $225.38 124513740124001
897300129126-Jul-19424 $382.00 19922166019901618 
907300129126-Jul-19424 $418.00 19922166019901609 

 

Highlighted

@DataComplianceNerdGive me a few minutes to work this over. Thanks.

Highlighted
Best Response confirmed by DataComplianceNerd (Occasional Contributor)
Solution

@George Hepworth 

 

Based on this sample data, these queries return three employee IDs with 2 (or more) Function Codes within the range of the data. To apply date range filtering, you can join this query back to the payroll data and filter it on date.

 

SELECT Payrolldata.ID, Payrolldata.FunctionCode
FROM Payrolldata
GROUP BY Payrolldata.ID, Payrolldata.FunctionCode;

 

Save this as UniqueEmployeeFunctionCodes

 

Use it in this query.

 

SELECT UniqueEmployeeFunctionCodes.ID, Count(UniqueEmployeeFunctionCodes.FunctionCode) AS MultipleFunctionCodes
FROM UniqueEmployeeFunctionCodes
GROUP BY UniqueEmployeeFunctionCodes.ID
HAVING (((Count(UniqueEmployeeFunctionCodes.FunctionCode))>1));

 

 

Highlighted
You are AMAZING!!! That is exactly what I needed. THANK YOU Soooooo much!!!! I appreciate your help.
Highlighted

@DataComplianceNerd  Congratulations on finding a solution to the problem.

 

Continued success with the project.

 

Sorry it took so long to work out.