Here’s the scenario —
I have two tables Names & Sentences:
Names Sentences
ID | Names ID | Description
1 | Fox 1 | The <1> jumped over the <2>
2 | Narwhal 2 | The <2> sailed to the <3>
3 | Moon
I need to return all the Descriptions from the Sentences table with the ID replaced with the corresponding Name from the Names table, e.g.
‘The Fox jumped over the Narwhal’, ‘The Narwhal sailed to the Moon’.
I’m stumped at where to begin with this, in theory it appears like a simple problem but my knowledge of manipulating Strings is limited.
Any help would be much appreciated!
Thanks.
This should at least get you started. This is messy to do because you have multiple-level replacements, and no
JOINkey in the data itself.This uses two
CROSS JOINs and a bunch of string functions, so it will be very inefficient. This will never run quickly on a large data set.