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'
ASKER CERTIFIED SOLUTION
SStory

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Log in to continue reading
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform for $9.99/mo
View membership options
Unlock 1 Answer and 3 Comments.
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
The Value of Experts Exchange in My Daily IT Life

Experts Exchange (EE) has become my company's go-to resource to get answers. I've used EE to make decisions, solve problems and even save customers. OutagesIO has been a challenging project and... Keep reading >>

Mike

Owner of Outages.IO
Phoenix, Arizona, United States
Member Since 2016
Join a full scale community that combines the best parts of other tools into one platform.
Unlock 1 Answer and 3 Comments.
View membership options
“All of life is about relationships, and EE has made a virtual community a real community. It lifts everyone's boat.”
William Peck

Member since 2004