[b]data in the table "words"[/b]
[COLOR="Blue"]word1 word2[/COLOR]
gold jewelry
jewelry diamond
I have the table like the above.
The code below yields the result below.
[b]code[/b]
SELECT word2 as word
FROM words
WHERE
word1='jewelry'
UNION ALL
SELECT word1 as word
FROM words
WHERE
word2='jewelry'
[b]result[/b]
diamond
gold
So far, so good.
Here goes what I want.
I have another table named myGroup1 like the below.
[b]data in the table "myGroup1"[/b]
[COLOR="Blue"]group1[/COLOR]
group1-1
group1-2
I like to yield my target result below joining the table “words” and “group1.”
[b]target result[/b]
diamond group1-1
diamond group1-2
gold group1-1
gold group1-2