All Forums Database
okhere 1 post Joined 07/16
06 Jul 2016
A problem with 'where'

Hi, i am fresh in sql and teradate. When i used ‘where’  to filter the data from AUG, 2004 
WHERE a.num_month<>8 and a.num_year<>2004
The result seems all the data from AUG in different years and from 2004 including all the months are excluded.
Why this happened? Thanks.

dnoeth 4628 posts Joined 11/04
06 Jul 2016

Well, this is exactly what you wrote: No data from the year 2004 and no data from any august :-)
You want either a.num_month<>8 OR a.num_year<>2004 or NOT(a.num_month = 8 AND a.num_year = 2004), the latter is a bit easier to understand, see
If you run Explain (F6) you will see that both result in the same search conditions.


You must sign in to leave a comment.