I have a subselect in my select statement:
select t1.a, t1.b, (select top 1 t2.a from where)
what I need is:
select t1.a, t1.b, (select top 1 t2.a, t2.b from where)
However, I get the error that I can only have one field.
Here is the sql. I'm stumped. Thanks for your help...
Select
cm.ChildStateID ,
pc.DateOfServic e,
(SELECT
TOP 1 pcr.specialtyid , sp.Description
FROM
ProviderAccount pa,
ProviderPayee pp,
Provider pr,
ProviderCredent ial pcr,
Specialty sp
WHERE
pca.ProviderID = PP.TaxID
and right(pca.Provi derSuffix,4) = substring(pa.Pa yeeSeq,1,4)
and PP.ID = PA.PayeeID
and PA.ProviderID = PR.ID
and pcr.ProviderID = PR.id
and pcr.SpecialtyID = sp.id)
from
Childmaster cm,
pclaim pc,
pclaimaux pca
where
pca.childid = cm.childstateid
and pc.id = pca.pclaimid
order by
cm.ChildStateID ,
pc.DateOfServic e
select t1.a, t1.b, (select top 1 t2.a from where)
what I need is:
select t1.a, t1.b, (select top 1 t2.a, t2.b from where)
However, I get the error that I can only have one field.
Here is the sql. I'm stumped. Thanks for your help...
Select
cm.ChildStateID ,
pc.DateOfServic e,
(SELECT
TOP 1 pcr.specialtyid , sp.Description
FROM
ProviderAccount pa,
ProviderPayee pp,
Provider pr,
ProviderCredent ial pcr,
Specialty sp
WHERE
pca.ProviderID = PP.TaxID
and right(pca.Provi derSuffix,4) = substring(pa.Pa yeeSeq,1,4)
and PP.ID = PA.PayeeID
and PA.ProviderID = PR.ID
and pcr.ProviderID = PR.id
and pcr.SpecialtyID = sp.id)
from
Childmaster cm,
pclaim pc,
pclaimaux pca
where
pca.childid = cm.childstateid
and pc.id = pca.pclaimid
order by
cm.ChildStateID ,
pc.DateOfServic e
Comment