sql - Query Transform and Pivot -


i have subtle problem , i'm unable solve until now. let's take example better explain problem:

i have table person: fields: id, name, option1, option1_value, option2, option2_value, option3, option3_value

i want query shows following:

id      name      reason 1       clark     option1 doesn't match, option2 doesn't match 2       stefan    option3 doesn't match 3       sandra    (no errors: ignore line) 4       steven    option2 doesn't match 

so has done is: every option field, check (a query that's going read , compare option_value using external table) , print options doesn't match in 1 field serves error output field.

is possible achieve using transform , pivot ? if so, please provide me tips , advise on how should use them ? if not, there alternative ? or maybe can vba-side ?

thank in advance guys miloud

your table has 3 options in row, how about:

select id, name,       iif(option1_value<>"something","option1 dosn't match",         iif (option2_value<>"something","option2 dosn't match",            iif( option3_value<>"something","option3 dosn't match","no errors")))      reason table 

it not quite clear post options not match, nor clear difference between option , option_value.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -