Select to view content in your preferred language

User-defined SQL join clause

1195
5
08-24-2022 02:31 PM
Status: Open
Labels (1)
Bud
by
Esteemed Contributor

When creating a dynamic/in-map join, it would be helpful if we could specify the join clause using SQL.

For example, join on multiple fields:
Instead of joining only on EVENT_ID=EVENT_ID, join on multiple fields: EVENT_ID=EVENT_ID AND YEAR=YEAR.

Bud_1-1661376632521.png

Bud_0-1661376474497.png

 

Tags (2)
5 Comments
KoryKramer

Thanks for submitting the idea @Bud Note that there is an existing idea to Join based on multiple fields

If that is the need, I'd say we can merge your idea with that one. Note in the comments, though, that you could try using the Make Query Layer tool.

Bud
by

@KoryKramer 

Thanks. I think it's worth keeping this idea separate. There are other cases where specifying the SQL would be useful. For example, using an SQL expression or function in the join clause.

Bud
by

This is how it’s done in other enterprise platforms.

Bud_0-1670415187084.png

You define an SQL WHERE clause for the join. You can join on multiple fields if you need to. And include complex expressions, case statements, subqueries, etc.

If you want to pare down a 1:M join to a 1:1 join, you can do that in the SQL clause too, using ORDER BY, FETCH FIRST ROW ONLY, etc. or just use a subquery.

Bud_1-1670415976240.png

Source: Field based on relationship: What if relationship is 1:M? and https://www.bpdzenith.com/the-bpd-blog/maximo-relationships

It’s similar to the idea of having a user-defined ORDER BY clause in a join: One-to-first joins: Control what related record is used

wayfaringrob

Allow a table to be joined to another table/layer using an expression as the input join field. This would allow users to more easily join data together when a key field is flawed or nonexistent but could be calculated with an expression. Ex. I have a TAXDIST field whose first two digits tell me the municipality, and I have a table with these two digits and their names that I'd like to join, but I can't do this without first adding adding and calculating a separate field to the input table, which I then wouldn't need after joining.

Field from the input table:

rburke_1-1671053634683.png

Cannot join this table without creating a new field in the input table and calculating with a Left() expression.

rburke_0-1671053598581.png

Idea is to allow the user to just enter the expression here:

rburke_2-1671053683716.png

with one of these bad boys:

rburke_3-1671053946818.png

Bud
by