<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: The complex query in query layer in ArcGIS Enterprise Questions</title>
    <link>https://community.esri.com/t5/arcgis-enterprise-questions/the-complex-query-in-query-layer/m-p/2419#M143</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The master view (not the table) created in the MSSQL only contains &lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt; x &amp;amp; y coordinates stored in two separate fields.&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Hank&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 12 Apr 2016 14:57:10 GMT</pubDate>
    <dc:creator>Chang-HengYang</dc:creator>
    <dc:date>2016-04-12T14:57:10Z</dc:date>
    <item>
      <title>The complex query in query layer</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/the-complex-query-in-query-layer/m-p/2411#M135</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your time in advance. I am wondering if any tool or layer in the ArcGIS could work with the SQL query directly. In my &lt;A _jive_internal="true" href="https://community.esri.com/thread/174318"&gt;previous post,&lt;/A&gt; Mody Buchbinder mentioned the &lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;MakeQueryTable&lt;/SPAN&gt; might work with the complex query listed below. However, it did not work. Now, I was told that the Query layer might work with the complex query. Or you would suggest to execute the complex query in the MSSQL server to get the data and export the data to ArcMap.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me know your valuable opinions.&amp;nbsp; &lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Hank &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #3d3d3d;"&gt;SELECT&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; t.POINT_ID,&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; t.CollectionDate,&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; t.HistoricDate,&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; t.U,&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; t.LAT,&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; t.LONG,&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; t.WellDepth,&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; t.DataSource&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #3d3d3d;"&gt;FROM&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (SELECT POINT_ID, MAX(CollectionDate) AS MaxValue&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FROM&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NM_Water_Quality.dbo.MASTER_UNION_Water_Quality&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHERE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (U IS NOT NULL) AND (U &amp;gt; 0)&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GROUP BY POINT_ID) AS x INNER JOIN&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NM_Water_Quality.dbo.MASTER_UNION_Water_Quality AS t ON x.POINT_ID = t.POINT_ID AND x.MaxValue = t.CollectionDate&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #3d3d3d;"&gt;WHERE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (t.U IS NOT NULL) AND (t.U &amp;gt; 0)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Apr 2016 16:25:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/the-complex-query-in-query-layer/m-p/2411#M135</guid>
      <dc:creator>Chang-HengYang</dc:creator>
      <dc:date>2016-04-08T16:25:00Z</dc:date>
    </item>
    <item>
      <title>Re: The complex query in query layer</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/the-complex-query-in-query-layer/m-p/2412#M136</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What RDBMS are you storing the data in?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you create a view in the database with this query and just add the view into ArcMap as a query layer?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Apr 2016 16:54:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/the-complex-query-in-query-layer/m-p/2412#M136</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2016-04-08T16:54:27Z</dc:date>
    </item>
    <item>
      <title>Re: The complex query in query layer</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/the-complex-query-in-query-layer/m-p/2413#M137</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;yes, it should work with query layer.&lt;/P&gt;&lt;P&gt;query layers are meant to support this kind of complex query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;as long as you don't have something in your sql that is not supported by your underline database in sub-queries then you should be fine.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Apr 2016 18:04:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/the-complex-query-in-query-layer/m-p/2413#M137</guid>
      <dc:creator>TanuHoque</dc:creator>
      <dc:date>2016-04-08T18:04:01Z</dc:date>
    </item>
    <item>
      <title>Re: The complex query in query layer</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/the-complex-query-in-query-layer/m-p/2414#M138</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The Query layer is working smoothly with the complex query. Now, I do not need to export to csv file by python. Instead, I used the Query Layer to export to the MSSQL as the database feature class. Then I can publish these data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Hank &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Apr 2016 15:48:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/the-complex-query-in-query-layer/m-p/2414#M138</guid>
      <dc:creator>Chang-HengYang</dc:creator>
      <dc:date>2016-04-11T15:48:51Z</dc:date>
    </item>
    <item>
      <title>Re: The complex query in query layer</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/the-complex-query-in-query-layer/m-p/2415#M139</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if your workflow requires you to come data into a feature class, then it is okay.&lt;/P&gt;&lt;P&gt;otherwise, you can directly publish a map with query layers as a map service and skip the export.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Apr 2016 15:59:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/the-complex-query-in-query-layer/m-p/2415#M139</guid>
      <dc:creator>TanuHoque</dc:creator>
      <dc:date>2016-04-11T15:59:44Z</dc:date>
    </item>
    <item>
      <title>Re: The complex query in query layer</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/the-complex-query-in-query-layer/m-p/2416#M140</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Tanu,&lt;/P&gt;&lt;P&gt;Thank you for the quick updating. In the master view created in MSSQL server, there is no field "Geometry". Therefore, I need to use the "Display X, Y Data" to create the feature class. I am wondering if you would recommend to put the field "Geometry" into the master view. Then I add the "Geometry" in my complex query. Otherwise, could you recommend any better idea?&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Hank&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Screen Shot 2016-04-11 at 10.08.17 AM.png" class="image-1 jive-image" src="/legacyfs/online/194500_Screen Shot 2016-04-11 at 10.08.17 AM.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Apr 2016 16:14:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/the-complex-query-in-query-layer/m-p/2416#M140</guid>
      <dc:creator>Chang-HengYang</dc:creator>
      <dc:date>2016-04-11T16:14:56Z</dc:date>
    </item>
    <item>
      <title>Re: The complex query in query layer</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/the-complex-query-in-query-layer/m-p/2417#M141</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;does any of your tables, that is participating in the query, have a field of 'geometry' type? or it is just x &amp;amp; y coordinates are stored in two separate fields?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Apr 2016 00:42:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/the-complex-query-in-query-layer/m-p/2417#M141</guid>
      <dc:creator>TanuHoque</dc:creator>
      <dc:date>2016-04-12T00:42:14Z</dc:date>
    </item>
    <item>
      <title>Re: The complex query in query layer</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/the-complex-query-in-query-layer/m-p/2418#M142</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Generating geometry on the fly is very expensive, both in raw performance cost and because it's not possible to build a spatial index, which effectively reduces the number of features supported by this sort of query below ten thousand rows (where a real geometry layer could easily support tens of millions of rows). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;While it's possible for a database to do this sort of query on a regular basis, you really ought to evaluate using the query to populate a "materialized view" (a real table, which contains the data after all the crunching is done), which will give you optimal performance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- V&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Apr 2016 02:56:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/the-complex-query-in-query-layer/m-p/2418#M142</guid>
      <dc:creator>VinceAngelo</dc:creator>
      <dc:date>2016-04-12T02:56:16Z</dc:date>
    </item>
    <item>
      <title>Re: The complex query in query layer</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/the-complex-query-in-query-layer/m-p/2419#M143</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The master view (not the table) created in the MSSQL only contains &lt;SPAN style="color: #3d3d3d; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt; x &amp;amp; y coordinates stored in two separate fields.&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Hank&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Apr 2016 14:57:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/the-complex-query-in-query-layer/m-p/2419#M143</guid>
      <dc:creator>Chang-HengYang</dc:creator>
      <dc:date>2016-04-12T14:57:10Z</dc:date>
    </item>
    <item>
      <title>Re: The complex query in query layer</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/the-complex-query-in-query-layer/m-p/2420#M144</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There is no table existed with the field "Geometry". There are some feature class tables with "Geometry" living in another database.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Apr 2016 15:10:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/the-complex-query-in-query-layer/m-p/2420#M144</guid>
      <dc:creator>Chang-HengYang</dc:creator>
      <dc:date>2016-04-12T15:10:54Z</dc:date>
    </item>
    <item>
      <title>Re: The complex query in query layer</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/the-complex-query-in-query-layer/m-p/2421#M145</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Cross-database queries usually perform poorly.&amp;nbsp; If you have spatial data somewhere, you'd be much better off accessing that data locally, or by establishing a process to replicate it (little 'r' "replicate", vice big 'R' "ArcGIS Geodatabase Replication") to the database to which you do have access.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- V&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Apr 2016 17:21:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/the-complex-query-in-query-layer/m-p/2421#M145</guid>
      <dc:creator>VinceAngelo</dc:creator>
      <dc:date>2016-04-12T17:21:25Z</dc:date>
    </item>
    <item>
      <title>Re: The complex query in query layer</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/the-complex-query-in-query-layer/m-p/1024083#M29398</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/26222"&gt;@Chang-HengYang&lt;/a&gt;&amp;nbsp;this has been a while but this use case is becoming more useful so I figured I'd share something we've learned. We do this sort of thing quite often and can validate what &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1060"&gt;@VinceAngelo&lt;/a&gt;&amp;nbsp;is saying about performance and replication etc. We have found a pattern that allows us to pull information from various instances and deliver a feature class with great performance. The one draw back is that it's not live (real-time views of the data in their tables). However, if your needs allow a regular update interval (daily or weekly etc) then give this a try.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Create a feature class in your Enterprise GDB with the same schema as the query layer you're trying to make.&lt;/LI&gt;&lt;LI&gt;Register it as versioned but indicate in metadata or other documentation that it is not to be edited by end users.&lt;/LI&gt;&lt;LI&gt;Create a stored procedure that can be run by a SQL Agent Job on a schedule that does the following:&lt;OL&gt;&lt;LI&gt;Based on&amp;nbsp;&lt;A href="https://desktop.arcgis.com/en/arcmap/10.7/manage-data/using-sql-with-gdbs/edit-versioned-data-using-sql-sqlserver.htm" target="_blank"&gt;https://desktop.arcgis.com/en/arcmap/10.7/manage-data/using-sql-with-gdbs/edit-versioned-data-using-sql-sqlserver.htm&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;Deletes all rows from the multi-version view (Same as the feature class name with '_evw' appended at the end)&lt;/LI&gt;&lt;LI&gt;Inserts the results of your query into the multi-version view&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;LI&gt;Running a compress on the database after these operations will help this perform better so that all of these new edits can be compressed into the base table.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;NOTE: There is a way to do it without registering it as versioned but you have to do some extra steps to handle the managed OBJECTID field in a way that leaves it in a consistent state with the Geodatabase (&lt;A href="https://desktop.arcgis.com/en/arcmap/10.7/manage-data/using-sql-with-gdbs/inserting-a-value-into-a-global-id-column-in-sql-server-using-sql.htm" target="_blank"&gt;https://desktop.arcgis.com/en/arcmap/10.7/manage-data/using-sql-with-gdbs/inserting-a-value-into-a-global-id-column-in-sql-server-using-sql.htm&lt;/A&gt;)&lt;/P&gt;&lt;P&gt;This allows the database to chug away at a hefty process when we don't have any users in the system and provide standard feature classes with spatial indexes to our users.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Feb 2021 23:22:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/the-complex-query-in-query-layer/m-p/1024083#M29398</guid>
      <dc:creator>DougGreen</dc:creator>
      <dc:date>2021-02-05T23:22:11Z</dc:date>
    </item>
  </channel>
</rss>

