SELECT CESTPrePostScores.PostDate, CESTrawPermanentPOST.Confirmation, CESTPrePostScores.PrePostID, AssessmentInfo.Name, AssessmentInfo.[DOC#], IIf([Program]="NJDOCE","ET",IIf([Program]="NJDCCH","CH",IIf([Program]="NJDRLP","RP",IIf([Program]="NJDISP","ISP",IIf([Program]="NJDCRS","ROIS"))))) AS Prgm, Left([Bed],6) AS Temp, IIf(Right([Temp],1)="H","Harmony",IIf(Right([Temp],1)="T","Tranquility",IIf(Right([Temp],1)="S","Serenity","Unknown"))) AS Unit, AssessmentInfo.SeniorCounselor, CESTPrePostScores.PreDate, CESTPrePostScores.PostDate, CESTPrePostScores.PreVal, CESTPrePostScores.PostVal, IIf([PostVal]<5,"Valid",IIf([PostVal]>9,"Significant Validity Issues","Confirm Validity")) AS ValComment, IIf([PostVal]>9,"ALERT - - RESULTS APPEAR INVALID") AS ValALERT, CESTPrePostScores.PrePR, CESTPrePostScores.PostPR, CESTCommentsPOST.PostPRMean, CESTCommentsPOST.PostPRSD, [PostPRMean]-[PostPRSD] AS PostPRMinus1, [PostPRMean]+[PostPRSD] AS PostPRPlus1, IIf([PostPR]<=[PostPRMinus1],[PostPRLowComment],IIf([PostPR]>=[PostPRPlus1],[PostPRHighComment],[PostPRAvgComment])) AS PostPRComment, IIf([PostPR]<=[PostPRMinus1],"ALERT") AS PostPRAlert, CESTPrePostScores.PreDH, CESTPrePostScores.PostDH, CESTCommentsPOST.PostDHMean, CESTCommentsPOST.PostDHSD, [PostDHMean]-[PostDHSD] AS PostDHMinus1, [PostDHMean]+[PostDHSD] AS PostDHPlus1, IIf([PostDH]<=[PostDHMinus1],[PostDHLowComment],IIf([PostDH]>=[PostDHPlus1],[PostDHHighComment],[PostDHAvgComment])) AS PostDHComment, IIf([PostDH]<=[PostDHMinus1],"ALERT") AS PostDHALERT, CESTPrePostScores.PreTR, CESTPrePostScores.PostTR, [PostTRMean]-[PostTRSD] AS PostTRMinus1, [PostTRMean]+[PostTRSD] AS PostTRPlus1, IIf([PostTR]<=[PostTRMinus1],[PostTRLowComment],IIf([PostTR]>=[PostTRPlus1],[PostTRHighComment],[PostTRAvgComment])) AS PostTRComment, IIf([PostTR]<=[PostTRMinus1],"ALERT") AS PostTRALERT, CESTPrePostScores.PrePT, CESTPrePostScores.PostPT, CESTCommentsPOST.PostPTMean, CESTCommentsPOST.PostPTSD, [PostPTMean]-[PostPTSD] AS PostPTMinus1, [PostPTMean]+[PostPTSD] AS PostPTPlus1, IIf([PostPT]<=[PostPTMinus1],[PostPTLowComment],IIf([PostPT]>=[PostPTPlus1],[PostPTHighComment],[PostPTAvgComment])) AS PostPTComment, IIf([PostPT]<=[PostPTMinus1],"ALERT") AS PostPTALERT, CESTPrePostScores.PreTN, CESTPrePostScores.PostTN, CESTCommentsPOST.PostTNMean, CESTCommentsPOST.PostTNSD, [PostTNMean]-[PostTNSD] AS PostTNMinus1, [PostTNMean]+[PostTNSD] AS PostTNPlus1, IIf([PostTN]<=[PostTNMinus1],[PostTNLowComment],IIf([PostTN]>=[PostTNPlus1],[PostTNHighComment],[PostTNAvgComment])) AS PostTNComment, IIf([PostTN]<=[PostTNMinus1],"ALERT") AS PostTNALERT, CESTPrePostScores.PreSE, CESTPrePostScores.PostSE, CESTCommentsPOST.PostSESD, CESTCommentsPOST.PostSEMean, [PostSEMean]-[PostSESD] AS PostSEMinus1, [PostSEMean]+[PostSESD] AS PostSEPlus1, IIf([PostSE]<=[PostSEMinus1],[PostSELowComment],IIf([PostSE]>=[PostSEPlus1],[PostSEHighComment],[PostSEAvgComment])) AS PostSEComment, IIf([PostSE]<=30,"ALERT") AS PostSEALERT, CESTPrePostScores.PreDP, CESTPrePostScores.PostDP, CESTCommentsPOST.PostDPMean, CESTCommentsPOST.PostDPSD, [PostDPMean]-[PostDPSD] AS PostDPMinus1, [PostDPMean]+[PostDPSD] AS PostDPPlus1, IIf([PostDP]<=[PostDPMinus1],[PostPRLowComment],IIf([PostDP]>=[PostDPPlus1],[PostDPHighComment],[PostDPAvgComment])) AS PostDPComment, IIf([PostDP]>=30,"ALERT") AS PostDPALERT, CESTPrePostScores.PreAX, CESTPrePostScores.PostAX, CESTCommentsPOST.PostAXMean, CESTCommentsPOST.PostAXSD, [PostAXMean]-[PostAXSD] AS PostAXMinus1, [PostAXMean]+[PostAXSD] AS PostAXPlus1, IIf([PostAX]<=[PostAXMinus1],[PostAXLowComment],IIf([PostAX]>=[PostAXPlus1],[PostAXHighComment],[PostAXAvgComment])) AS PostAXComment, IIf([PostAX]>=30,"ALERT") AS PostAXALERT, CESTPrePostScores.PreDM, CESTPrePostScores.PostDM, CESTCommentsPOST.PostDMMean, CESTCommentsPOST.PostDMSD, [PostDMMean]-[PostDMSD] AS PostDMMinus1, [PostDMMean]+[PostDMSD] AS PostDMPlus1, IIf([PostDM]<=[PostDMMinus1],[PostDMLowComment],IIf([PostDM]>=[PostDMPlus1],[PostDMHighComment],[PostDMAvgComment])) AS PostDMComment, IIf([PostDM]<=30,"ALERT") AS PostDMALERT, CESTPrePostScores.PreHS, CESTPrePostScores.PostHS, CESTCommentsPOST.PostHSSD, CESTCommentsPOST.PostHSMean, [PostHSMean]-[PostHSSD] AS PostHSMinus1, [PostHSMean]+[PostHSSD] AS PostHSPlus1, IIf([PostHS]<=[PostHSMinus1],[PostHSLowComment],IIf([PostHS]>=[PostHSPlus1],[PostHSHighComment],[PostHSAvgComment])) AS PostHSComment, IIf([PostHS]>=[PostHSPlus1],"ALERT") AS PostHSALERT, CESTPrePostScores.PreRT, CESTPrePostScores.PostRT, CESTCommentsPOST.PostRTMean, CESTCommentsPOST.PostRTSD, [PostRTMean]-[PostRTSD] AS PostRTMinus1, [PostRTMean]+[PostRTSD] AS PostRTPlus1, IIf([PostRT]<=[PostRTMinus1],[PostRTLowComment],IIf([PostRT]>=[PostRTPlus1],[PostRTHighComment],[PostRTAvgComment])) AS PostRTComment, IIf([PostRT]>=[PostRTPlus1],"ALERT") AS PostRTALERT, CESTPrePostScores.PreSS, CESTPrePostScores.PostSS, CESTCommentsPOST.PostSSMean, CESTCommentsPOST.PostSSSD, [PostSSMean]-[PostSSSD] AS PostSSMinus1, [PostSSMean]+[PostSSSD] AS PostSSPlus1, IIf([PostSS]<=[PostSSMinus1],[PostSSLowComment],IIf([PostSS]>=[PostSSPlus1],[PostSSHighComment],[PostSSAvgComment])) AS PostSSComment, IIf([PostSS]<=30,"ALERT") AS PostSSALERT, CESTPrePostScores.PreEN, CESTPrePostScores.PostEN, CESTCommentsPOST.PostENMean, CESTCommentsPOST.PostENSD, [PostENMean]-[PostENSD] AS PostENMinus1, [PostENMean]+[PostENSD] AS PostENPlus1, IIf([PostEN]<=[PostENMinus1],[PostENLowComment],IIf([PostEN]>=[PostENPlus1],[PostENHighComment],[PostENAvgComment])) AS PostENComment, IIf([PostEN]>=[PostENPlus1],"ALERT") AS PostENALERT, CESTPrePostScores.PreJU, CESTPrePostScores.PostJU, CESTCommentsPOST.PostJUMean, CESTCommentsPOST.PostJUSD, [PostJUMean]-[PostJUSD] AS PostJUMinus1, [PostJUMean]+[PostJUSD] AS PostJUPlus1, IIf([PostJU]<=[PostJUMinus1],[PostJULowComment],IIf([PostJU]>=[PostJUPlus1],[PostJUHighComment],[PostJUAvgComment])) AS PostJUComment, IIf([PostJU]>=[PostJUPlus1],"ALERT") AS PostJUALERT, CESTPrePostScores.PrePO, CESTPrePostScores.PostPO, CESTCommentsPOST.PostPOMean, CESTCommentsPOST.PostPOSD, [PostPOMean]-[PostPOSD] AS PostPOMinus1, [PostPOMean]+[PostPOSD] AS PostPOPlus1, IIf([PostPO]<=[PostPOMinus1],[PostPOLowComment],IIf([PostPO]>=[PostPOPlus1],[PostPOHighComment],[PostPOAvgComment])) AS PostPOComment, IIf([PostPO]>=[PostPOPlus1],"ALERT") AS PostPOALERT, CESTPrePostScores.PreCH, CESTPrePostScores.PostCH, CESTCommentsPOST.PostCHMean, CESTCommentsPOST.PostCHSD, [PostCHMean]-[PostCHSD] AS PostCHMinus1, [PostCHMean]+[PostCHSD] AS PostCHPlus1, IIf([PostCH]<=[PostCHMinus1],[PostCHLowComment],IIf([PostCH]>=[PostCHPlus1],[PostCHHighComment],[PostCHAvgComment])) AS PostCHComment, IIf([PostCH]>=[PostCHPlus1],"ALERT") AS PostCHALERT, CESTPrePostScores.PreCN, CESTPrePostScores.PostCN, CESTCommentsPOST.PostCNSD, CESTCommentsPOST.PostCNMean, [PostCNMean]-[PostCNSD] AS PostCNMinus1, [PostCNMean]+[PostCNSD] AS PostCNPlus1, IIf([PostCN]<=[PostCNMinus1],[PostCNLowComment],IIf([PostCN]>=[PostCNPlus1],[PostCNHighComment],[PostCNAvgComment])) AS PostCNComment, IIf([PostCN]>=[PostCNPlus1],"ALERT") AS PostCNALERT, CESTPrePostScores.PrePI, CESTPrePostScores.PostPI, CESTCommentsPOST.PostPIMean, CESTCommentsPOST.PostPISD, [PostPIMean]-[PostPISD] AS PostPIMinus1, [PostPIMean]+[PostPISD] AS PostPIPlus1, IIf([PostPI]<=[PostPIMinus1],[PostPILowComment],IIf([PostPI]>=[PostPIPlus1],[PostPIHighComment],[PostPIAvgComment])) AS PostPIComment, IIf([PostPI]>=[PostPIPlus1],"ALERT") AS PostPIALERT, CESTPrePostScores.PostTS, CESTCommentsPOST.PostTSMean, CESTCommentsPOST.PostTSSD, [PostTSMean]-[PostTSSD] AS PostTSMinus1, [PostTSMean]+[PostTSSD] AS PostTSPlus1, IIf([PostTS]<=[PostTSMinus1],[PostTSLowComment],IIf([PostTS]>=[PostTSPlus1],[PostTSHighComment],[PostTSAvgComment])) AS PostTSComment, IIf([PostTS]>=[PostTSPlus1],"ALERT") AS PostTSALERT, CESTPrePostScores.PostTP, CESTCommentsPOST.PostTPMean, CESTCommentsPOST.PostTPSD, [PostTPMean]-[PostTPSD] AS PostTPMinus1, [PostTPMean]+[PostTPSD] AS PostTPPlus1, IIf([PostTP]<=[PostTPMinus1],[PostTPLowComment],IIf([PostTP]>=[PostTPPlus1],[PostTPHighComment],[PostTPAvgComment])) AS PostTPComment, IIf([PostTP]>=[PostTPPlus1],"ALERT") AS PostTPALERT, CESTPrePostScores.PostCR, CESTCommentsPOST.PostCRMean, CESTCommentsPOST.PostCRSD, [PostCRMean]-[PostCRSD] AS PostCRMinus1, [PostCRMean]+[PostCRSD] AS PostCRPlus1, IIf([PostCR]<=[PostCRMinus1],[PostCRLowComment],IIf([PostCR]>=[PostCRPlus1],[PostCRHighComment],[PostCRAvgComment])) AS PostCRComment, IIf([PostCR]>=[PostCRPlus1],"ALERT") AS PostCRALERT, CESTPrePostScores.PostPS, CESTCommentsPOST.PostPSMean, CESTCommentsPOST.PostPSSD, [PostPSMean]-[PostPSSD] AS PostPSMinus1, [PostPSMean]+[PostPSSD] AS PostPSPlus1, IIf([PostPS]<=[PostPSMinus1],[PostPSLowComment],IIf([PostPS]>=[PostPSPlus1],[PostPSHighComment],[PostPSAvgComment])) AS PostPSComment, IIf([PostPS]>=[PostPSPlus1],"ALERT") AS PostPSALERT, CESTPrePostScores.PreDS, CESTPrePostScores.PostDS, IIf([PostDS]>2,"Admits to problematic substance abuse",IIf([PostDS]=0,"Absolutely denies any substance abuse issues","Minor substance abuse issues reported")) AS [Drug Screen Comment], IIf([PostDS]>4,"ALERT") AS [Drug Screen ALERT], IIf([q187]=1,"Not at all",IIf([q187]=2,"Slightly",IIf([q187]=3,"Moderately",IIf([q187]=4,"Considerably",IIf([q187]=5,"Extremely","Error"))))) AS [Serious Drug Problem], IIf([q188]=1,"Not at all",IIf([q188]=2,"Slightly",IIf([q188]=3,"Moderately",IIf([q188]=4,"Considerably",IIf([q188]=5,"Extremely","Error"))))) AS [Get Treatment], IIf([q29]=1,"Disagree Strongly",IIf([q29]=2,"Disagree",IIf([q29]=3,"Uncertain",IIf([q29]=4,"Agree",IIf([q29]=5,"Agree Strongly","Left Blank"))))) AS Selling