Reputation: 29
Here I have two tables. One is called table1
and has a column word
, which is of datatype varchar(500)
and looks like
a
pen
book
like
nice
.....
Another table is table2
and has a column meaning
of datatype ntext
and looks like
one
a long thin object used for writing
reading material
to enjoy
pleasant
.......
Now I want to join table1 and table2 and with them make a another table table3
table3
will have two columns that are word
and meaning
" column and will look like
a one
pen a long thin object used for writing
book reading material
like to enjoy
nice pleasant
..... .......
How can I do that in SQL Server?
Upvotes: 0
Views: 956
Reputation: 92795
You better have a PRIMARY KEY column in table1 (lets call it terms) and a FOREIGN KEY column in table2 (lets call it definitions). Then you can join both tables using these columns to get your result
SELECT term, definition
FROM terms t LEFT JOIN
definitions d ON t.termid = d.termid
Here is sqlfiddle
IMHO there is no need for table3. You just use a query like this to get desired result.
This way if need be you can store more than one definition per term.
Upvotes: 1