AnsweredAssumed Answered

Why is a spatial view returning empty or null records when field has a domain?

Question asked by pughr on Apr 8, 2019
Latest reply on Apr 9, 2019 by pughr

I'm attempting to create a spatial view between a feature class (wHydrant) and a related table (wHydrant_Maint).  I can successfully create views by querying every field in the Hydrant_Maint table, except one (Maint_Activity).  The only difference from the other fields is that this Maint_Activity field has a domain.  Any attempt to create a view with a WHERE clause on this field will return an empty view with no records returned.  When querying other fields, but including this field in the selection, all the results in this field return as null, even though there are in fact entries.  Here is my SQL statement that returns all NULL records in the Maint_Activity field:

SELECT h.OBJECTID, h.FACILITYID, h.SHAPE, r.Hydrant_ID, r.MAINT_ACTIVITY, r.MaintDate, r.GlobalID

FROM wHydrant h

JOIN wHydrant_Maint r

ON h.FACILITYID = r.Hydrant_ID

WHERE r.MaintDate >= '2014' AND r.MaintDate <= '2015'

 

The following returns an empty table view:

SELECT h.OBJECTID, h.FACILITYID, h.SHAPE, r.Hydrant_ID, r.MAINT_ACTIVITY, r.MaintDate, r.GlobalID
FROM wHydrant h
JOIN wHydrant_Maint r
ON h.FACILITYID = r.Hydrant_ID
WHERE r.MAINT_ACTIVITY = 'Flushed'

Do I need to adjust my syntax to account for a domained field?  Also, the code and description for the domain match, in case you're thinking I should query the code for 'Flushed'.  

Outcomes