Sunday, March 25, 2012

Create Table

Hello,

I have 2 tables:

[Categories] > CategoryId, Category

[Strings] > String

I want to create a new table as follows:

[CategoriesFound] > CategoryId, CategoryFound

The "CategoryFound" column in this table is filled with all the
"String" records in Strings.
Then the CategoryId is taken from table Categories where
Categories.Category = Strings.String.

How can I do this?

Thanks,
Miguel

INSERT INTO CategoriesFound (CategoryId, CategoryFound)SELECT CategoryId, CategoryFROM Categories CJOIN Strings SON C.Category = S.String

No comments:

Post a Comment