Subject | Re: UNION Problems |
---|---|
Author | zapperon |
Post date | 2005-01-19T05:22:35Z |
Thanks Helen this works great.
I changed the SQl code to the following.
SELECT WPVBSQ , LrgAddrTyp , LrgAddrData
FROM LargeAddress
WHERE WPVBSQ IN
(
SELECT CrtInfIDSQ
FROM CreativeInfo
WHERE (CrtInfName LIKE '%SMITH%' OR CrtInfDescription LIKE '%CAR
DEALER%'
)
GROUP BY WPVBSQ , LrgAddrTyp , LrgAddrData
UNION
SELECT WPVBSQ , SmllAddrTyp , CAST (SmllAddrData as VARCHAR(100))
FROM SmallAddress
WHERE WPVBSQ IN
(
SELECT CrtInfIDSQ
FROM CreativeInfo
WHERE (CrtInfName LIKE '%SMITH%' OR CrtInfDescription LIKE '%CAR
DEALER%'
)
GROUP BY WPVBSQ , SmllAddrTyp , SmllAddrData
Is there a way to group the total results.
Also I can't use the INTERSECT operator , does it have another name or
is there another way of doing an intersect. And how does one specify
the fields at which the INTERSECT must look at to determine its
results ?
I changed the SQl code to the following.
SELECT WPVBSQ , LrgAddrTyp , LrgAddrData
FROM LargeAddress
WHERE WPVBSQ IN
(
SELECT CrtInfIDSQ
FROM CreativeInfo
WHERE (CrtInfName LIKE '%SMITH%' OR CrtInfDescription LIKE '%CAR
DEALER%'
)
GROUP BY WPVBSQ , LrgAddrTyp , LrgAddrData
UNION
SELECT WPVBSQ , SmllAddrTyp , CAST (SmllAddrData as VARCHAR(100))
FROM SmallAddress
WHERE WPVBSQ IN
(
SELECT CrtInfIDSQ
FROM CreativeInfo
WHERE (CrtInfName LIKE '%SMITH%' OR CrtInfDescription LIKE '%CAR
DEALER%'
)
GROUP BY WPVBSQ , SmllAddrTyp , SmllAddrData
Is there a way to group the total results.
Also I can't use the INTERSECT operator , does it have another name or
is there another way of doing an intersect. And how does one specify
the fields at which the INTERSECT must look at to determine its
results ?