| Author |
Topic  |
|
|
phil3061
Starting Member
4 Posts |
Posted - 04/25/2012 : 11:44:22
|
Hello,
I have a table I'm trying to query. Every time a form is submitted there are 26 rows associated with that form in the table. There is 1 column named "vcObjectName" that if it has a value of "New York Target", I need to look in the column "vcAnswerValue" to see if it was answered "Yes" or "No". Can I query it so that it outputs all 26 rows associated with that form to have a new column with "Yes" or "No" listed on every row depending on the answer from the "vcAnswerValue" column.
Thanks, Phil |
|
|
Lamprey
Flowing Fount of Yak Knowledge
3829 Posts |
|
|
phil3061
Starting Member
4 Posts |
Posted - 04/25/2012 : 13:11:40
|
I actually don't have access to it. I only have access to the view. Basically, I'm trying to create a computed column by reading 2 different columns in the array. So every 26 rows will be 1 array. Within each array, can I create a computed column that looks at column "vcObjectName" to find what row has the value "New York Target", once that row is determined, go to column "vcAnswerValue" and grab the value in that same row that "New York Target" is on. Then in the calculated column, attach to all 26 rows "yes" or "no".
Table querying "vcName", "vcObjectName" , "vcAnswerValue" "Bob" , "New York Target", "Yes" "Bob" , "Q1" , "No" "Bob" , "Q2" , "No"
Expected Output Table querying "vcName", "vcObjectName" , "vcAnswerValue", "Calculated Column" "Bob" , "New York Target", "Yes" , "Yes" "Bob" , "Q1" , "No" , "Yes" "Bob" , "Q2" , "No" , "Yes"
Sorry, I know the formatting is off, but this hopefully gives you an idea of what I'm trying to accomplish. |
 |
|
|
webfred
Flowing Fount of Yak Knowledge
Germany
8514 Posts |
Posted - 04/25/2012 : 14:17:25
|
select t1.vcName, t1.vcObjectName, t1.vcAnswerValue, dt.CalcColumn from table1 as t1 join (select distinct vcName, vcAnswerValue as CalcColumn from table where vcObjectName='New York Target')dt on dt.vcName=t1.vcName
No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
phil3061
Starting Member
4 Posts |
Posted - 04/25/2012 : 17:31:30
|
| AWESOME....that's exactly what I needed. THANK YOU!!! |
 |
|
| |
Topic  |
|
|
|