M
mgm
This query gives me an error in Access because the subqueries return more
than 1 record however in query analyzer with a sql table it works:
Select certexpiry.[organization name] AS OrgName
, '2' as CertVer2
, (Select certexpiry.[Expiration Date] From CertExpiry where
certexpiry.[cert version] = '2' and certexpiry.[organization name] =
certexpiry.[organization name]) as NewExpDate
, (Select certexpiry.IsActive From CertExpiry where certexpiry.[cert
version] = '2' and certexpiry.[organization name] =
certexpiry.[organization name]) as NewIsActive
, (Select certexpiry.IsLoaded From CertExpiry where certexpiry.[cert
version] = '2' and certexpiry.[organization name] =
certexpiry.[organization name]) as NewIsLoaded
, '1' as CertVer1
, (Select certexpiry.[Expiration Date] From CertExpiry where
certexpiry.[cert version] = '1' and certexpiry.[organization name] =
certexpiry.[organization name]) as OldExpDate
, (Select certexpiry.IsActive From CertExpiry where certexpiry.[cert
version] = '1' and certexpiry.[organization name] =
certexpiry.[organization name]) as OldIsActive
, (Select certexpiry.IsLoaded From CertExpiry where certexpiry.[cert
version] = '1' and certexpiry.[organization name] =
certexpiry.[organization name]) as OldIsLoaded
From CertExpiry
Group by certexpiry.[organization name]
I'm basically rotating a table (view); do you know how i can make this work?
This is how i have it in SQL:
Select OrgName
,C2 = 2
,NewExpDate = (Select expdate From CertExpiry where CertVersion = 2
and OrgName = C.OrgName)
,NewIsActive = (Select IsActive From CertExpiry where CertVersion = 2
and OrgName = C.OrgName)
,NewIsLoaded = (Select IsLoaded From CertExpiry where CertVersion = 2
and OrgName = C.OrgName)
,C1 = 1
,OldExpDate = (Select expdate From CertExpiry where CertVersion = 1
and OrgName = C.OrgName)
,OldIsActive = (Select IsActive From CertExpiry where CertVersion = 1
and OrgName = C.OrgName)
,OldIsLoaded = (Select IsLoaded From CertExpiry where CertVersion = 1
and OrgName = C.OrgName)
From CertExpiry C
Group by OrgName
than 1 record however in query analyzer with a sql table it works:
Select certexpiry.[organization name] AS OrgName
, '2' as CertVer2
, (Select certexpiry.[Expiration Date] From CertExpiry where
certexpiry.[cert version] = '2' and certexpiry.[organization name] =
certexpiry.[organization name]) as NewExpDate
, (Select certexpiry.IsActive From CertExpiry where certexpiry.[cert
version] = '2' and certexpiry.[organization name] =
certexpiry.[organization name]) as NewIsActive
, (Select certexpiry.IsLoaded From CertExpiry where certexpiry.[cert
version] = '2' and certexpiry.[organization name] =
certexpiry.[organization name]) as NewIsLoaded
, '1' as CertVer1
, (Select certexpiry.[Expiration Date] From CertExpiry where
certexpiry.[cert version] = '1' and certexpiry.[organization name] =
certexpiry.[organization name]) as OldExpDate
, (Select certexpiry.IsActive From CertExpiry where certexpiry.[cert
version] = '1' and certexpiry.[organization name] =
certexpiry.[organization name]) as OldIsActive
, (Select certexpiry.IsLoaded From CertExpiry where certexpiry.[cert
version] = '1' and certexpiry.[organization name] =
certexpiry.[organization name]) as OldIsLoaded
From CertExpiry
Group by certexpiry.[organization name]
I'm basically rotating a table (view); do you know how i can make this work?
This is how i have it in SQL:
Select OrgName
,C2 = 2
,NewExpDate = (Select expdate From CertExpiry where CertVersion = 2
and OrgName = C.OrgName)
,NewIsActive = (Select IsActive From CertExpiry where CertVersion = 2
and OrgName = C.OrgName)
,NewIsLoaded = (Select IsLoaded From CertExpiry where CertVersion = 2
and OrgName = C.OrgName)
,C1 = 1
,OldExpDate = (Select expdate From CertExpiry where CertVersion = 1
and OrgName = C.OrgName)
,OldIsActive = (Select IsActive From CertExpiry where CertVersion = 1
and OrgName = C.OrgName)
,OldIsLoaded = (Select IsLoaded From CertExpiry where CertVersion = 1
and OrgName = C.OrgName)
From CertExpiry C
Group by OrgName