Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Teradata SQL Assistant query - Condition in WHERE statement

Status
Not open for further replies.

dprayner

Programmer
Oct 14, 2002
140
US
Good afternoon experts.

I am trying to filter out some extraneous records, and I need to put conditionA or conditionB in a WHERE statement, and being relatively new to Teradata I am unsure how to handle it in SQL.

For example:

SELECT [field1], [field2], [field3]
FROM tblABC
WHERE
IF conditionA THEN something = something
ELSEIF condition THEN something <> something
END IF

I have not had much luck with IF, and I have been experimented with CASE / WITH. The concept of WHERE seems to require WHERE something = something and challenging to set a variable condition.

Thank you, WHEELS
 

I'm not certain, but I think this will do what you're looking for:

SELECT [field1], [field2], [field3]
FROM tblABC
WHERE
(
conditionA
AND something = something
)
OR
(
conditionB
AND something <> something
)

Glenn
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top