I'm just learning SQL so apologies for the poorly worded question. I'm basically trying to create a spatial view of hydrants that have been painted in 2018. I have a hydrant feature class (wHydrant) and a hydrant maintenance table (wHydrant_Maint). They are related by a common ID, although the names of the fields that contain the common ID are different. Here are my first few lines that I can get to return a view of all my hydrants with maintenance records:
SELECT h.OBJECTID, h.FACILITYID, h.SHAPE FROM wHydrant h JOIN wHydrant_Maint r ON h.FACILITYID = r.Hydrant_ID
My issue (well, my issue is that I don’t know or use SQL…) is that I don’t know how to start the next part of the statement. I can do it using the definition query builder, no problem! But creating the proper statement is alluding me. I’m essentially trying to say: wHydrant_Maint.MAINT_ACTIVITY = 'Paint' and MaintDate > '2018’. I thought I could just tack on a WHERE statement, but I think because it’s pulling from the related table that maybe there is additional syntax. I'm using ArcGIS 10.5.1 and a SQL Server Enterprise database.