M
Marsha
I've got two seperate make-table queries that are both supposed to
populate into the same table. One works, the other doesn't. I have a
feeling it is something very simple I'm overlooking, but I can't figure
out what it is. I don't get any errors on the query that isn't
populating...just that it will add 0 rows?
Query 1 that works:
SELECT DISTINCT Trim([ScanTest7].[SSN]) AS SSN1, Trim([VisitDate]) AS
VisitDate1, Trim([VisitType]) AS VisitType1, ScanTest7.MedAdj,
Trim([Residence]) AS Residence1, Trim([PrimaryDiagnosis]) AS Diagnosis,
ScanTest8.StimulatorState,
IIf([ScanTest8].[Hoehnandyahr]>0,[ScanTest8].[HoehnandYahr]," ") AS
[HoehnAndYahr Scale],
IIf([Scantest5].[leveloffunctioning]>0,[ScanTest5].[leveloffunctioning],"
") AS [Schwab and England Scale], ScanTest.PainScale AS [Pain Index],
IIf([ScanTest2].[Memory]>0,[ScanTest2].[Memory]," ") AS [UPDRS 1],
IIf([ScanTest2].[Vividdreamshallucinations]>0,[ScanTest2].[Vividdreamshallucinations],"
") AS [UPDRS 2],
IIf([ScanTest2].[Depressed]>0,[ScanTest2].[Depressed]," ") AS [UPDRS
3], IIf([ScanTest2].[Speach]>0,[ScanTest2].[Speach]," ") AS [UPDRS 5],
IIf([ScanTest2].[Swallowing]>0,[ScanTest2].[Swallowing]," ") AS [UPDRS
7], IIf([ScanTest2].[Falling]>0,[ScanTest2].[Falling]," ") AS [UPDRS
13], IIf([ScanTest3].[Walking]>0,[ScanTest3].[Walking]," ") AS [UPDRS
15], IIf([ScanTest4].[Dyskinesias]>0,[ScanTest4].[Dyskinesias]," ") AS
[UPDRS 32],
IIf([ScanTest4].[howdisablingdyskinesias]>0,[ScanTest4].[howdisablingdyskinesias],"
") AS [UPDRS 33],
IIf([ScanTest5].[periodofdayoff]>0,[ScanTest5].[periodofdayoff]," ") AS
[UPDRS 39],
IIf([ScanTest5].[sleepproblems]>0,[ScanTest5].[Sleepproblems]," ") AS
[UPDRS 41],
IIf([ScanTest5].[lightheadeddizzy]>0,[ScanTest5].[lightheadeddizzy],"
") AS [UPDRS 42], ScanTest7.CurAmantadine, ScanTest7.CurBenzotropine,
ScanTest7.CurBromocriptine, ScanTest7.CurCitalopram,
ScanTest7.CurClozapine, ScanTest7.CurEntacapone,
ScanTest7.CurFludrocortisone, ScanTest7.CurFluoxetine,
ScanTest7.CurFluvoxamine, ScanTest7.CurLevodopaCarbidopaCR,
ScanTest7.CurLevodopaCarbidopaIR, ScanTest7.CurMidodrine,
ScanTest7.CurOther, ScanTest7.CurParaoxetine, ScanTest7.CurPergolide,
ScanTest7.CurPramipexole, ScanTest7.CurQuetiapine,
ScanTest7.CurRopinirole, ScanTest7.CurSelegiline,
ScanTest7.CurSertraline, ScanTest7.CurTolcapone,
ScanTest7.CurTrihexyphenidyl,
[memory]+[VividDreamsHallucinations]+[Depressed] AS [UPDRS I],
[Speach]+[Swallowing]+[Falling]+[Walking] AS [UPDRS II],
[Dyskinesias]+[HowDisablingDyskinesias]+[pERIODOFDAYOFF] AS [UPDRS
III], [SleepProblems]+[LightheadedDizzy] AS [UPDRS IV],
[NF06-Scantest3].[EQ-5D] INTO Visit
FROM (((((((ScanTest7 INNER JOIN (ScanTest INNER JOIN ScanTest6 ON
ScanTest.SSN = ScanTest6.SSN) ON ScanTest7.SSN = ScanTest.SSN) INNER
JOIN ScanTest8 ON ScanTest.SSN = ScanTest8.SSN) INNER JOIN ScanTest5 ON
ScanTest.SSN = ScanTest5.SSN) INNER JOIN ScanTest4 ON ScanTest.SSN =
ScanTest4.SSN) INNER JOIN ScanTest2 ON ScanTest.SSN = ScanTest2.SSN)
INNER JOIN ScanTest3 ON ScanTest.SSN = ScanTest3.SSN) INNER JOIN
Scantest9 ON ScanTest.SSN = Scantest9.SSN) INNER JOIN [NF06-Scantest3]
ON (ScanTest.VisitDate = [NF06-Scantest3].VisitDate) AND (ScanTest.SSN
= [NF06-Scantest3].SSN);
Query 2 that doesn't work:
SELECT DISTINCT Trim([NF06-Scantest1].[SSN]) AS SSN1,
IIf([NF06-ScanTest1].[VisitDate]," ") AS VisitDate1,
Trim([NF06-Scantest5].[VisitType]) AS VisitType1,
Trim([NF06-Scantest6].[MedicationAdjustment]) AS MedAdj,
Trim([NF06-Scantest2].[Residence]) AS Residence1,
([NF06-Scantest5].[PrimaryDiagnosis]) AS Diagnosis,
IIf([NF06-Scantest8].[HoehnandYahr]>0,[NF06-ScanTest8].[HoehnandYahr],"
") AS [HoehnAndYahr Scale],
IIf([NF06-Scantest8].[SchwabandEngland]>0,[NF06-Scantest8].[SchwabandEngland],"
") AS [Schwab and England Scale], [NF06-Scantest2].PainIndex AS [Pain
Index], IIf([NF06-Scantest2].[Memory]>0,[NF06-Scantest2].[Memory]," ")
AS [UPDRS 1],
IIf([NF06-Scantest2].[Hallucinations]>0,[NF06-Scantest2].[Hallucinations],"
") AS [UPDRS 2],
IIf([NF06-Scantest2].[SadDepressed]>0,[NF06-Scantest2].[SadDepressed],"
") AS [UPDRS 3],
IIf([NF06-Scantest2].[Speech]>0,[NF06-Scantest2].[Speech]," ") AS
[UPDRS 5],
IIf([NF06-Scantest2].[Swallowing]>0,[NF06-Scantest2].[Swallowing]," ")
AS [UPDRS 7], IIf([NF06-Scantest3].[Falls]>0,[NF06-Scantest3].[Falls],"
") AS [UPDRS 13],
IIf([NF06-Scantest3].[AbilitytoWalk]>0,[NF06-Scantest3].[AbilitytoWalk],"
") AS [UPDRS 15],
IIf([NF06-Scantest7].[Dyskinesias]>0,[NF06-ScanTest7].[Dyskinesias],"
") AS [UPDRS 32],
IIf([NF06-Scantest7].[DisablingDyskinesias]>0,[NF06-Scantest7].[DisablingDyskinesias],"
") AS [UPDRS 33],
IIf([NF06-ScanTest7].[PercentOff]>0,[NF06-Scantest7].[PercentOff]," ")
AS [UPDRS 39],
IIf([NF06-Scantest7].[SleepProblems]>0,[NF06-Scantest7].[SleepProblems],"
") AS [UPDRS 41],
IIf([NF06-Scantest7].[Dizzy]>0,[NF06-Scantest7].[Dizzy]," ") AS [UPDRS
42], ([NF06-Scantest6].[AmantadineCr]) AS CurAmantadine,
([NF06-Scantest6].[ApomorphineCr]) AS CurApomorphine,
([NF06-Scantest6].[BotulinumACr]) AS CurBotulinumA,
([NF06-Scantest6].[BotulinumBCr]) AS CurBotulinumB,
([NF06-Scantest6].[ClozapineCr]) AS CurClozapine,
([NF06-Scantest6].[FludrocortisoneCr]) AS CurFludrocortisone,
([NF06-Scantest6].[MidodrineCr]) AS CurMidodrine,
([NF06-Scantest6].[QuetiapineCr]) AS CurQuetiapine,
([NF06-Scantest6].[CitalopramCr]) AS CurCitalopram,
([NF06-Scantest6].[FlueoxetineCr]) AS CurFlueoxetine,
([NF06-Scantest6].[FluvoxamineCr]) AS CurFluvoxamine,
([NF06-Scantest6].[BenztropineCr]) AS CurBenztropine,
([NF06-Scantest6].[PramipexoleCr]) AS CurPramipexole,
([NF06-Scantest6].[SelegilineCr]) AS CurSelegiline,
([NF06-Scantest6].[TrihexyphenidylCr]) AS CurTrihexyphenidyl,
([NF06-Scantest6].[ParoxetineCr]) AS CurParoxetine,
([NF06-Scantest6].[SertralineCr]) AS CurSertraline,
([NF06-Scantest6].[Levodopa-carbidopa-CRCr]) AS
[CurLevodopa-carbidopa-CR],
([NF06-Scantest6].[Levodopa-Carbidopa-IRCr]) AS
[CurLevodopa-carbidopa-IR], ([NF06-Scantest6].[RopiniroleCr]) AS
CurRopinirole, ([NF06-Scantest6].[TolcaponeCr]) AS CurTolcapone,
([NF06-Scantest6].[Levodopa-carbidopa-entacaponeCr]) AS
[CurLevodopa-carbidopa-entacapone], ([NF06-Scantest6].[EntacaponeCr])
AS CurEntacapone, ([NF06-Scantest6].[MemantineCr]) AS CurMemantine,
([NF06-Scantest6].[RivastigmineCr]) AS CurRivastigmine,
([NF06-Scantest6].[GalantamineCr]) AS CurGalantamine,
([NF06-Scantest6].[DonepezilCr]) AS CurDonepezil,
([NF06-Scantest6].[Other1Cr]) AS CurOther,
[memory]+[Hallucinations]+[SadDepressed] AS [UPDRS I],
[Speech]+[Swallowing]+[Falls]+[AbilitytoWalk] AS [UPDRS II],
[Dyskinesias]+[DisablingDyskinesias]+[PercentOff] AS [UPDRS III],
[SleepProblems]+[Dizzy] AS [UPDRS IV], [NF06-Scantest3].[EQ-5D] INTO
Visit
FROM ((((((([NF06-Scantest1] INNER JOIN [NF06-Scantest2] ON
([NF06-Scantest1].SSN = [NF06-Scantest2].SSN) AND
([NF06-Scantest1].VisitDate = [NF06-Scantest2].VisitDate)) INNER JOIN
[NF06-Scantest3] ON ([NF06-Scantest1].SSN = [NF06-Scantest3].SSN) AND
([NF06-Scantest1].VisitDate = [NF06-Scantest3].VisitDate)) INNER JOIN
[NF06-Scantest4] ON ([NF06-Scantest1].SSN = [NF06-Scantest4].SSN) AND
([NF06-Scantest1].VisitDate = [NF06-Scantest4].VisitDate)) INNER JOIN
[NF06-Scantest5] ON ([NF06-Scantest1].SSN = [NF06-Scantest5].SSN) AND
([NF06-Scantest1].VisitDate = [NF06-Scantest5].VisitDate)) INNER JOIN
[NF06-Scantest6] ON ([NF06-Scantest1].SSN = [NF06-Scantest6].SSN) AND
([NF06-Scantest1].VisitDate = [NF06-Scantest6].VisitDate)) INNER JOIN
[NF06-Scantest7] ON ([NF06-Scantest1].SSN = [NF06-Scantest7].SSN) AND
([NF06-Scantest1].VisitDate = [NF06-Scantest7].VisitDate)) INNER JOIN
[NF06-Scantest8] ON ([NF06-Scantest1].SSN = [NF06-Scantest8].SSN) AND
([NF06-Scantest1].VisitDate = [NF06-Scantest8].VisitDate)) INNER JOIN
[NF06-Scantest9] ON ([NF06-Scantest1].SSN = [NF06-Scantest9].SSN) AND
([NF06-Scantest1].VisitDate = [NF06-Scantest9].VisitDate);
Suggestions??
populate into the same table. One works, the other doesn't. I have a
feeling it is something very simple I'm overlooking, but I can't figure
out what it is. I don't get any errors on the query that isn't
populating...just that it will add 0 rows?
Query 1 that works:
SELECT DISTINCT Trim([ScanTest7].[SSN]) AS SSN1, Trim([VisitDate]) AS
VisitDate1, Trim([VisitType]) AS VisitType1, ScanTest7.MedAdj,
Trim([Residence]) AS Residence1, Trim([PrimaryDiagnosis]) AS Diagnosis,
ScanTest8.StimulatorState,
IIf([ScanTest8].[Hoehnandyahr]>0,[ScanTest8].[HoehnandYahr]," ") AS
[HoehnAndYahr Scale],
IIf([Scantest5].[leveloffunctioning]>0,[ScanTest5].[leveloffunctioning],"
") AS [Schwab and England Scale], ScanTest.PainScale AS [Pain Index],
IIf([ScanTest2].[Memory]>0,[ScanTest2].[Memory]," ") AS [UPDRS 1],
IIf([ScanTest2].[Vividdreamshallucinations]>0,[ScanTest2].[Vividdreamshallucinations],"
") AS [UPDRS 2],
IIf([ScanTest2].[Depressed]>0,[ScanTest2].[Depressed]," ") AS [UPDRS
3], IIf([ScanTest2].[Speach]>0,[ScanTest2].[Speach]," ") AS [UPDRS 5],
IIf([ScanTest2].[Swallowing]>0,[ScanTest2].[Swallowing]," ") AS [UPDRS
7], IIf([ScanTest2].[Falling]>0,[ScanTest2].[Falling]," ") AS [UPDRS
13], IIf([ScanTest3].[Walking]>0,[ScanTest3].[Walking]," ") AS [UPDRS
15], IIf([ScanTest4].[Dyskinesias]>0,[ScanTest4].[Dyskinesias]," ") AS
[UPDRS 32],
IIf([ScanTest4].[howdisablingdyskinesias]>0,[ScanTest4].[howdisablingdyskinesias],"
") AS [UPDRS 33],
IIf([ScanTest5].[periodofdayoff]>0,[ScanTest5].[periodofdayoff]," ") AS
[UPDRS 39],
IIf([ScanTest5].[sleepproblems]>0,[ScanTest5].[Sleepproblems]," ") AS
[UPDRS 41],
IIf([ScanTest5].[lightheadeddizzy]>0,[ScanTest5].[lightheadeddizzy],"
") AS [UPDRS 42], ScanTest7.CurAmantadine, ScanTest7.CurBenzotropine,
ScanTest7.CurBromocriptine, ScanTest7.CurCitalopram,
ScanTest7.CurClozapine, ScanTest7.CurEntacapone,
ScanTest7.CurFludrocortisone, ScanTest7.CurFluoxetine,
ScanTest7.CurFluvoxamine, ScanTest7.CurLevodopaCarbidopaCR,
ScanTest7.CurLevodopaCarbidopaIR, ScanTest7.CurMidodrine,
ScanTest7.CurOther, ScanTest7.CurParaoxetine, ScanTest7.CurPergolide,
ScanTest7.CurPramipexole, ScanTest7.CurQuetiapine,
ScanTest7.CurRopinirole, ScanTest7.CurSelegiline,
ScanTest7.CurSertraline, ScanTest7.CurTolcapone,
ScanTest7.CurTrihexyphenidyl,
[memory]+[VividDreamsHallucinations]+[Depressed] AS [UPDRS I],
[Speach]+[Swallowing]+[Falling]+[Walking] AS [UPDRS II],
[Dyskinesias]+[HowDisablingDyskinesias]+[pERIODOFDAYOFF] AS [UPDRS
III], [SleepProblems]+[LightheadedDizzy] AS [UPDRS IV],
[NF06-Scantest3].[EQ-5D] INTO Visit
FROM (((((((ScanTest7 INNER JOIN (ScanTest INNER JOIN ScanTest6 ON
ScanTest.SSN = ScanTest6.SSN) ON ScanTest7.SSN = ScanTest.SSN) INNER
JOIN ScanTest8 ON ScanTest.SSN = ScanTest8.SSN) INNER JOIN ScanTest5 ON
ScanTest.SSN = ScanTest5.SSN) INNER JOIN ScanTest4 ON ScanTest.SSN =
ScanTest4.SSN) INNER JOIN ScanTest2 ON ScanTest.SSN = ScanTest2.SSN)
INNER JOIN ScanTest3 ON ScanTest.SSN = ScanTest3.SSN) INNER JOIN
Scantest9 ON ScanTest.SSN = Scantest9.SSN) INNER JOIN [NF06-Scantest3]
ON (ScanTest.VisitDate = [NF06-Scantest3].VisitDate) AND (ScanTest.SSN
= [NF06-Scantest3].SSN);
Query 2 that doesn't work:
SELECT DISTINCT Trim([NF06-Scantest1].[SSN]) AS SSN1,
IIf([NF06-ScanTest1].[VisitDate]," ") AS VisitDate1,
Trim([NF06-Scantest5].[VisitType]) AS VisitType1,
Trim([NF06-Scantest6].[MedicationAdjustment]) AS MedAdj,
Trim([NF06-Scantest2].[Residence]) AS Residence1,
([NF06-Scantest5].[PrimaryDiagnosis]) AS Diagnosis,
IIf([NF06-Scantest8].[HoehnandYahr]>0,[NF06-ScanTest8].[HoehnandYahr],"
") AS [HoehnAndYahr Scale],
IIf([NF06-Scantest8].[SchwabandEngland]>0,[NF06-Scantest8].[SchwabandEngland],"
") AS [Schwab and England Scale], [NF06-Scantest2].PainIndex AS [Pain
Index], IIf([NF06-Scantest2].[Memory]>0,[NF06-Scantest2].[Memory]," ")
AS [UPDRS 1],
IIf([NF06-Scantest2].[Hallucinations]>0,[NF06-Scantest2].[Hallucinations],"
") AS [UPDRS 2],
IIf([NF06-Scantest2].[SadDepressed]>0,[NF06-Scantest2].[SadDepressed],"
") AS [UPDRS 3],
IIf([NF06-Scantest2].[Speech]>0,[NF06-Scantest2].[Speech]," ") AS
[UPDRS 5],
IIf([NF06-Scantest2].[Swallowing]>0,[NF06-Scantest2].[Swallowing]," ")
AS [UPDRS 7], IIf([NF06-Scantest3].[Falls]>0,[NF06-Scantest3].[Falls],"
") AS [UPDRS 13],
IIf([NF06-Scantest3].[AbilitytoWalk]>0,[NF06-Scantest3].[AbilitytoWalk],"
") AS [UPDRS 15],
IIf([NF06-Scantest7].[Dyskinesias]>0,[NF06-ScanTest7].[Dyskinesias],"
") AS [UPDRS 32],
IIf([NF06-Scantest7].[DisablingDyskinesias]>0,[NF06-Scantest7].[DisablingDyskinesias],"
") AS [UPDRS 33],
IIf([NF06-ScanTest7].[PercentOff]>0,[NF06-Scantest7].[PercentOff]," ")
AS [UPDRS 39],
IIf([NF06-Scantest7].[SleepProblems]>0,[NF06-Scantest7].[SleepProblems],"
") AS [UPDRS 41],
IIf([NF06-Scantest7].[Dizzy]>0,[NF06-Scantest7].[Dizzy]," ") AS [UPDRS
42], ([NF06-Scantest6].[AmantadineCr]) AS CurAmantadine,
([NF06-Scantest6].[ApomorphineCr]) AS CurApomorphine,
([NF06-Scantest6].[BotulinumACr]) AS CurBotulinumA,
([NF06-Scantest6].[BotulinumBCr]) AS CurBotulinumB,
([NF06-Scantest6].[ClozapineCr]) AS CurClozapine,
([NF06-Scantest6].[FludrocortisoneCr]) AS CurFludrocortisone,
([NF06-Scantest6].[MidodrineCr]) AS CurMidodrine,
([NF06-Scantest6].[QuetiapineCr]) AS CurQuetiapine,
([NF06-Scantest6].[CitalopramCr]) AS CurCitalopram,
([NF06-Scantest6].[FlueoxetineCr]) AS CurFlueoxetine,
([NF06-Scantest6].[FluvoxamineCr]) AS CurFluvoxamine,
([NF06-Scantest6].[BenztropineCr]) AS CurBenztropine,
([NF06-Scantest6].[PramipexoleCr]) AS CurPramipexole,
([NF06-Scantest6].[SelegilineCr]) AS CurSelegiline,
([NF06-Scantest6].[TrihexyphenidylCr]) AS CurTrihexyphenidyl,
([NF06-Scantest6].[ParoxetineCr]) AS CurParoxetine,
([NF06-Scantest6].[SertralineCr]) AS CurSertraline,
([NF06-Scantest6].[Levodopa-carbidopa-CRCr]) AS
[CurLevodopa-carbidopa-CR],
([NF06-Scantest6].[Levodopa-Carbidopa-IRCr]) AS
[CurLevodopa-carbidopa-IR], ([NF06-Scantest6].[RopiniroleCr]) AS
CurRopinirole, ([NF06-Scantest6].[TolcaponeCr]) AS CurTolcapone,
([NF06-Scantest6].[Levodopa-carbidopa-entacaponeCr]) AS
[CurLevodopa-carbidopa-entacapone], ([NF06-Scantest6].[EntacaponeCr])
AS CurEntacapone, ([NF06-Scantest6].[MemantineCr]) AS CurMemantine,
([NF06-Scantest6].[RivastigmineCr]) AS CurRivastigmine,
([NF06-Scantest6].[GalantamineCr]) AS CurGalantamine,
([NF06-Scantest6].[DonepezilCr]) AS CurDonepezil,
([NF06-Scantest6].[Other1Cr]) AS CurOther,
[memory]+[Hallucinations]+[SadDepressed] AS [UPDRS I],
[Speech]+[Swallowing]+[Falls]+[AbilitytoWalk] AS [UPDRS II],
[Dyskinesias]+[DisablingDyskinesias]+[PercentOff] AS [UPDRS III],
[SleepProblems]+[Dizzy] AS [UPDRS IV], [NF06-Scantest3].[EQ-5D] INTO
Visit
FROM ((((((([NF06-Scantest1] INNER JOIN [NF06-Scantest2] ON
([NF06-Scantest1].SSN = [NF06-Scantest2].SSN) AND
([NF06-Scantest1].VisitDate = [NF06-Scantest2].VisitDate)) INNER JOIN
[NF06-Scantest3] ON ([NF06-Scantest1].SSN = [NF06-Scantest3].SSN) AND
([NF06-Scantest1].VisitDate = [NF06-Scantest3].VisitDate)) INNER JOIN
[NF06-Scantest4] ON ([NF06-Scantest1].SSN = [NF06-Scantest4].SSN) AND
([NF06-Scantest1].VisitDate = [NF06-Scantest4].VisitDate)) INNER JOIN
[NF06-Scantest5] ON ([NF06-Scantest1].SSN = [NF06-Scantest5].SSN) AND
([NF06-Scantest1].VisitDate = [NF06-Scantest5].VisitDate)) INNER JOIN
[NF06-Scantest6] ON ([NF06-Scantest1].SSN = [NF06-Scantest6].SSN) AND
([NF06-Scantest1].VisitDate = [NF06-Scantest6].VisitDate)) INNER JOIN
[NF06-Scantest7] ON ([NF06-Scantest1].SSN = [NF06-Scantest7].SSN) AND
([NF06-Scantest1].VisitDate = [NF06-Scantest7].VisitDate)) INNER JOIN
[NF06-Scantest8] ON ([NF06-Scantest1].SSN = [NF06-Scantest8].SSN) AND
([NF06-Scantest1].VisitDate = [NF06-Scantest8].VisitDate)) INNER JOIN
[NF06-Scantest9] ON ([NF06-Scantest1].SSN = [NF06-Scantest9].SSN) AND
([NF06-Scantest1].VisitDate = [NF06-Scantest9].VisitDate);
Suggestions??