SUPPORT / SAMPLES & SAS NOTES
 

Support

Problem Note 54658: When you submit a query with a WHERE clause, you might get unexpected results

DetailsHotfixAboutRate It

You might get unexpected results when you submit a query with a WHERE clause.

For example, the following demonstrates this behavior in SAS/ACCESS® Interface to Netezza. The query is to multiple nested views that contain ORDER BY clauses and aggregate functions and a WHERE clause. If a DISTINCT clause was used when the nested views were created, the WHERE is ignored.

libname nzwork netezza server=server-name database=database-name user=user-ID password=password preserve_names=yes; proc sql; create view work.query_for_class_nz as select t1.name, t1.sex, t1.age from nzwork.class_nz t1 where t1.age > 14 order by t1.name; quit; /* contains the order by clause */ proc sql; create view work.query_for_class_nz_0003 as select t1.sex, /*sum_of_age */ (sum(t1.age)) as sum_of_age from work.query_for_class_nz t1 group by t1.sex order by t1.sex; quit; /* contains the where clause */ proc sq; create table work.query_for_class_nz_0001 as select t1.sex, t1.sum_of_age from work.query_for_class_nz_0003 t1 where t1.sex = 'Z'; quit;

Tracing shows the absence of the WHERE:

NETEZZA_8: Prepared: on connection 3
 select t1."Sex", SUM(t1."Age") as "SUM_of_Age" from "TEST".."CLASS_NZ" t1 where
t1."Age" > 14 group by t1."Sex" order by
t1."Sex" asc

Using DISTINCT when creating the view results in the same behavior:

proc sql; create view work.query_for_class_nz_0003 as select distinct t1.sex, /*sum_of_age */ (sum(t1.age)) as sum_of_age from work.query_for_class_nz t1 group by t1.sex; quit; proc sq; create table work.query_for_class_nz_0001 as select t1.sex, t1.sum_of_age from work.query_for_class_nz_0003 t1 where t1.sex = 'Z'; quit;

Tracing again shows the absence of the WHERE:

NETEZZA_8: Prepared: on connection 3
 select distinct t1."Sex", SUM(t1."Age") as "SUM_of_Age" from "TEST".."CLASS_NZ"
t1 where t1."Age" > 14 group by t1."Sex"


Operating System and Release Information

Product FamilyProductSystemProduct ReleaseSAS Release
ReportedFixed*ReportedFixed*
SAS SystemSAS/ACCESS Interface to NetezzaMicrosoft® Windows® for x649.3_M19.4_M29.3 TS1M29.4 TS1M3
Microsoft Windows 8 Enterprise 32-bit9.3_M19.4_M29.3 TS1M29.4 TS1M3
Microsoft Windows 8 Enterprise x649.3_M19.4_M29.3 TS1M29.4 TS1M3
Microsoft Windows 8 Pro 32-bit9.3_M19.4_M29.3 TS1M29.4 TS1M3
Microsoft Windows 8 Pro x649.3_M19.4_M29.3 TS1M29.4 TS1M3
Microsoft Windows 8.1 Enterprise 32-bit9.3_M19.4_M29.3 TS1M29.4 TS1M3
Microsoft Windows 8.1 Enterprise x649.3_M19.4_M29.3 TS1M29.4 TS1M3
Microsoft Windows 8.1 Pro9.3_M19.4_M29.3 TS1M29.4 TS1M3
Microsoft Windows 8.1 Pro 32-bit9.3_M19.4_M29.3 TS1M29.4 TS1M3
Microsoft Windows Server 2003 Datacenter Edition9.3_M19.3 TS1M2
Microsoft Windows Server 2003 Enterprise Edition9.3_M19.3 TS1M2
Microsoft Windows Server 2003 Standard Edition9.3_M19.3 TS1M2
Microsoft Windows Server 2003 for x649.3_M19.3 TS1M2
Microsoft Windows Server 20089.3_M19.4_M29.3 TS1M29.4 TS1M3
Microsoft Windows Server 2008 R29.3_M19.4_M29.3 TS1M29.4 TS1M3
Microsoft Windows Server 2008 for x649.3_M19.4_M29.3 TS1M29.4 TS1M3
Microsoft Windows Server 2012 Datacenter9.3_M19.4_M29.3 TS1M29.4 TS1M3
Microsoft Windows Server 2012 R2 Datacenter9.3_M19.4_M29.3 TS1M29.4 TS1M3
Microsoft Windows Server 2012 R2 Std9.3_M19.4_M29.3 TS1M29.4 TS1M3
Microsoft Windows Server 2012 Std9.3_M19.4_M29.3 TS1M29.4 TS1M3
Microsoft Windows XP Professional9.3_M19.3 TS1M2
Windows 7 Enterprise 32 bit9.3_M19.4_M29.3 TS1M29.4 TS1M3
Windows 7 Enterprise x649.3_M19.4_M29.3 TS1M29.4 TS1M3
Windows 7 Home Premium 32 bit9.3_M19.4_M29.3 TS1M29.4 TS1M3
Windows 7 Home Premium x649.3_M19.4_M29.3 TS1M29.4 TS1M3
Windows 7 Professional 32 bit9.3_M19.4_M29.3 TS1M29.4 TS1M3
Windows 7 Professional x649.3_M19.4_M29.3 TS1M29.4 TS1M3
Windows 7 Ultimate 32 bit9.3_M19.4_M29.3 TS1M29.4 TS1M3
Windows 7 Ultimate x649.3_M19.4_M29.3 TS1M29.4 TS1M3
Windows Vista9.3_M19.3 TS1M2
Windows Vista for x649.3_M19.3 TS1M2
64-bit Enabled AIX9.3_M19.4_M29.3 TS1M29.4 TS1M3
64-bit Enabled HP-UX9.3_M19.4_M29.3 TS1M29.4 TS1M3
64-bit Enabled Solaris9.3_M19.4_M29.3 TS1M29.4 TS1M3
HP-UX IPF9.3_M19.4_M29.3 TS1M29.4 TS1M3
Linux9.3_M19.4_M29.3 TS1M29.4 TS1M3
Linux for x649.3_M19.4_M29.3 TS1M29.4 TS1M3
* For software releases that are not yet generally available, the Fixed Release is the software release in which the problem is planned to be fixed.