This content has been marked as final. Show 5 replies
The help states the following:
SELECT * FROM forms the first part of the SQL expression and is automatically supplied for you. Because you are selecting columns as a whole, you cannot restrict the SELECT to return only some of the columns in the corresponding table; thus, the hard-coded SELECT * syntax. For this reason, keywords like DISTINCT, ORDER BY, GROUP BY, and so on, cannot be used readily in a SQL query except when using subqueries.
So what you could try and do (I must warn I have not tried this) is create a sub query that performs the limit then use the IN command to select out the records that you need, I.e:
objectID IN (select objectID from (select objectID, column from 'table' where 'expression' order by 'column' limit 100))
I say don't know if this will work but you never know
Thanks for the reply Anthony.
I am able to get a full SQL query against the table using the below code..
string sql = "SELECT * FROM " + tableName RowCollection rows = geodatabase.ExecuteSQL(sql);
From my knowledge the ExecuteSQL function will take raw valid SQL outlined in the doc's but the doc's do not show any way to limit the returned result (i.e LIMIT or TOP).
TOP, LIMIT is not currently supported.
Lance are there any plans to support TOP functionality or any of the SELECT modifiers (ie DISTINCT)? I think its odd that there isn't a way to access full SQL query abilities. Thanks
I believe you will find that SELECT DISTINCT has worked all along.
There are no immediate plans to implement SELECT TOP. I am not convinced that it is particularly useful. If you want the equivalent of SELECT TOP 100 * from xxx, why not just keep track of how many rows you have read in and then stop after you hit 100?