Select to view content in your preferred language

Definition query to show every nth record plus the last record

463
4
Jump to solution
08-06-2024 08:28 AM
MattHowe
Frequent Contributor

I have a line layer together with a point layer representing a mark every 1m along the line. Essentially KPs along a cable route starting from say 0 to 50. As well as a point every 1m there is a point at the end of the line. For example 1, 2, 3, 4, 5 ... 47, 48, 49, 50, 50.4 if the line isn't exactly 50m in length.

A query of MOD(MP, 10)=0 will give me a point every 10m but doesn't include the last point. 

How can I create a query that displays a point every nth value PLUS the end point.

MattHowe_0-1722958239287.png

 

 

1 Solution

Accepted Solutions
AlfredBaldenweck
MVP Regular Contributor

If it's in an enterprise gdb, try adding a 

OR MP in (Select Top 1 MP from TABLE)

 

If in a file gdb, I don't think it's possible 

View solution in original post

4 Replies
AlfredBaldenweck
MVP Regular Contributor

If it's in an enterprise gdb, try adding a 

OR MP in (Select Top 1 MP from TABLE)

 

If in a file gdb, I don't think it's possible 

AlfredBaldenweck
MVP Regular Contributor

Oops. This will only work for one feature at a time. Add a GROUP BY or other aggregate function to make it work.

0 Kudos
MattHowe
Frequent Contributor

Thanks @AlfredBaldenweck. Initially it will be a FGDB so I'll make a note there'll be a bit of elbow grease needed.

0 Kudos
Bud
by
Esteemed Contributor

Idea: ROW_NUMBER function in FGDB SQL

As a very last resort, you could temporarily copy the data to a mobile geodatabase, and then use SQLite SQL to select the rows you want.