Quantcast
Channel: Forums - ArcGIS for Desktop - General
Viewing all articles
Browse latest Browse all 2328

SQL subquery - how to select top 1 element ordered by date

$
0
0
Hello.

I have 2 tables. In 1st one I have elements that have ID, ID2 and NAME columns. ID2 is a column needed for second table. In 2nd table I have ID, SOMENUMBERS, SOMENUMBERS2, DATE and ID2 columns.

In first table there are uniqe elements, In second I have hundreds of entries
I want to join those two tables on ID2 column. But there is a DATE column. Is there any way to join those tables that first is sorted by date from newest to oldest, then shown only first entry then joined by ID2 column?

I know i must use subquery. But how?
PS. I use postgre sql

Viewing all articles
Browse latest Browse all 2328

Trending Articles