
January 30th, 2013, 03:20 PM
|
|
Registered User
|
|
Join Date: Jan 2013
Posts: 1
Time spent in forums: 14 m 15 sec
Reputation Power: 0
|
|
|
Create a query off of a view and calculate a new field
I am fairly new to SQL, I have taken various courses through college and now am finally starting to development my skills in my job so please bare with me here.
I am trying to create a query that will run through two different tables, analyze two columns and based on the conditions within these two columns, create a new column with a true or false statement.
What I have so far is my query lists the information I want (excluding a new column) and has the conditions I would like to check in the WHERE statement. If [Item57Text] or [Item58Text] contain certain words I would like the new field in the new column to say true, if not I want the field to be false.
Code:
SELECT
[dbo].[Q58_v2].ID 'Text ID',
Item57Text 'Question 57',
Item58Text 'Question 58'
FROM
[dbo].[Q57_v2] INNER JOIN [dbo].[Q58_v2]
ON
[dbo].[Q57_v2].[ID]=[dbo].[Q58_v2].[ID]
WHERE
(Item57Text LIKE '%CONFUSING%') OR (Item58Text LIKE '%CONFUSING%')
|