Union join in SQLDataAdapter

A

axapta

Hi Group,
Can someone show me the syntax of a union join for a SQLDataAdapter? I've
created the SQL and it runs in Query Analyser. However when I copy the
query into the DataAdapter dialog box, it cannot construct the SQL. All the
datatypes match - the correct results are returned in Query Analyser.

TIA

This is what I have:
SELECT offer.regno, offer.quotacode, offer.sublistcode, offer.offerdate,
nomprop.propname, nomprop.number, nomprop.letter, nomprop.addr1,
nomprop.addr2, nomprop.addr3, nomprop.postcode, offer.assoccode,
offer.offerstatusdate, offer.offerstatuscode, codevalue.codetype AS
Offer_Status,
codevalue.codedesc, offer.tenancydate,
codevalue_1.codetype, codevalue_1.codedesc AS Offer_Type_Desc
FROM nomprop INNER JOIN
offer ON CAST(nomprop.propid AS varchar(10)) = offer.propid
INNER JOIN
codevalue ON offer.offerstatuscode = codevalue.code
INNER JOIN
codevalue codevalue_1 ON offer.offertypecode =
codevalue_1.code
WHERE (offer.assoccode <> '') AND (codevalue.codetype = 'OFST') AND
(codevalue_1.codetype = 'OFFR')
union
SELECT offer.regno, offer.quotacode, offer.sublistcode, offer.offerdate,
counciladdr.flat AS Propname, counciladdr.number, counciladdr.letter,
street.addr1,
street.addr2, district.addr3, street.postcode,
offer.assoccode, offer.offerstatusdate, offer.offerstatuscode,
codevalue.codetype as Offer_Status,
codevalue.codedesc,offer.viewingdate, codevalue.codetype,
codevalue.codedesc as Offer_Type_Desc

FROM street INNER JOIN
counciladdr ON street.postcode = counciladdr.postcode AND street.pcind =
counciladdr.pcind INNER JOIN
offer ON counciladdr.propid = offer.propid INNER JOIN
district ON street.distid = district.distid INNER JOIN
codevalue ON offer.offertypecode = codevalue.code
WHERE (street.distid <> '') AND (codevalue.codetype = 'OFFR')
order by offer.offerstatusdate desc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top