vb.net - SQL Statement in VB to Join w/ Area Code -


so first have 2 tables-

  1. main output table
  2. geocode replacement/correction table

first thing leftjoin - if main output table matches geocodes on replacement table, swaps them out.

however have 3 columns in main output table geocodes can go:

  1. zipcity
  2. zipstate
  3. zipnation

this determines lot of factors depending on geocode placed.

now kicker: geocode replacement table has 2 exceptions although geocode city related, needs go state. special exceptions. made checkbox mark them.

for these exceptions checkbox'd - want sql/select statement check if checkbox checked, , if - mark zipstate. if not marked, keep zipcity.

my biggest problem: below select coding, keeps giving me syntax error complaining operator. have triple checked million times, , under impression doesn't multiple [column name] statements in single column select.

qdquery.sql = "select iif(input.zipcity not null, iif(input.zipcity=[geocodes].     [replacegeocode],iif([geocodes].[exceptionchkbox],[geocodes]![replacementgeocode]      [zip state], [geocodes]![replacementgeocode] [zip city]), input.zipcity       [zip city]), input.geocity [zip city])" _     & "  input left join [geocodes] on input.zipcity=[geocodes].[replacegeocode]         or input.zipstate=[geocodes].[replacegeocode] or input.zipnation=[geocodes].       [replacegeocode]"  

any appreciated!

i'm not overly familiar access, should work:

select      iif(input.zipcity not null,          iif(input.zipcity=[geocodes].[replacegeocode],             iif([geocodes].[exceptionchkbox],                 null,                  [geocodes]![replacementgeocode]             ),              input.zipcity),          input.geocity     ) [zip city],      iif(input.zipcity not null,          iif(input.zipcity=[geocodes].[replacegeocode],             iif([geocodes].[exceptionchkbox],                 [geocodes]![replacementgeocode],                 null             ),              null),          null     ) [zip state]     input      left join [geocodes]      on input.zipcity = [geocodes].[replacegeocode]      or input.zipstate = [geocodes].[replacegeocode]      or input.zipnation = [geocodes].[replacegeocode] 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -