troubleshooting Question

Re-write SQL statement in VB. NET

Avatar of jsctechy
jsctechyFlag for United States of America asked on
Visual Basic Classic
3 Comments1 Solution166 ViewsLast Modified:
hi there a have a sql query that i need to run it on my application, but when i add the quotations is giving me some errors. Here is the actual SQL statement can you experts help me figuring this out?

SELECT DISTINCT
CD_MAIN.NUMBER_KEY as PERMIT_NO, CT_MAIN.BUS_NAME as CONT_BUS,
ISNULL(CT_MAIN.CON_NAME, TAX_ROLL.NAME_LINE_1 + ' ' + TAX_ROLL.NAME_LINE_2 ) as LETTER_NAME, --OwnerTable.CON_NAME
ISNULL (CT_MAIN.ADDRESS, TAX_ROLL.ADDRESS_LINE_1) as LETTER_ADDRESS_1,
ISNULL (CT_MAIN.CITY + ' ' + CT_MAIN.STATE + ' ' + CT_MAIN.ZIP, TAX_ROLL.ADDRESS_LINE_2) as LETTER_ADDRESS_2

FROM      ((CD_MAIN
            INNER JOIN CD_ADDRESS ON CD_MAIN.NUMBER_KEY = CD_ADDRESS.NUMBER_KEY and CD_MAIN.TYPE_DEPT ='BUILDING'
            INNER JOIN CD_Parcel ON CD_MAIN.NUMBER_KEY = CD_PARCEL.NUMBER_KEY)
            LEFT OUTER JOIN CD_PEOPLE ContractorTable on CD_MAIN.NUMBER_KEY = ContractorTable.LINK_KEY and ContractorTable.RELATIONSHIP <>'OWNER')
            LEFT OUTER JOIN CT_MAIN ON ContractorTable.CON_KEY = CT_MAIN.ELEMENT_KEY
            LEFT OUTER JOIN CD_PEOPLE OwnerTable ON CD_MAIN.NUMBER_KEY = OwnerTable.LINK_KEY and OwnerTable.RELATIONSHIP ='OWNER'
            LEFT OUTER JOIN TAX_ROLL ON CD_Address.PARCEL_NO = TAX_ROLL.FOLIO_NUMBER

WHERE
      CD_MAIN.NUMBER_KEY = 'PermitNumber'
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 3 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros