2021-03-31

How to create a "hard-coded" small SQL join table in code?

Context: I do not have the ability to create/update/edit the tables in question.

I have two tables that I am trying to join via a manual SQL query in Tableau. There exists a column in each table I can use to link the tables together, but I need a third table (that does not exist) to link them.

There are only 6 values I'd like to link, I was hoping there is some way to declare an "in-memory" table or similar in SQL to join these tables.

For example - I'd like to join these two tables together:

Table 1

name value
place 1 14
place 2 10
place 3 100

Table 2

identifier property
superstore awesome
hospital bad
port great

Can I somehow hard-code the following "table" into SQL code to join them?

hard coded table

name identifier
place 1 hospital
place 2 port
place 3 superstore

Should yield the following:

name identifier value property
place 1 hospital 14 bad
place 2 port 10 great
place 3 superstore 100 awesome

If I could create a new table with the linkage above I would, but I can't.

If it's relevant - this is using an Oracle database.

Thank you for your help!



from Recent Questions - Stack Overflow https://ift.tt/3cBvk4y
https://ift.tt/eA8V8J

No comments:

Post a Comment