Let's assume that I have two tables... Foo and Bar. They contain the following data.
Table Foo:
Foo_Id
------
100
101
Table Bar:
Bar_Id
------
200
201
As you can see, each table has two records. I'd like to join these tables together in a way where they return two records; the ultimate goal is to create a one to one relationship for these records even though at this state they do not have that relationship. The results of this data would go into table Foo_Bar to store this new relationship.
Ideally, the output would look similar to the following.
Foo_Id Bar_Id
------ ------
100 200
101 201
This code will be used in a T/SQL stored procedure. I could write this easily with a while loop, but I would prefer not to use a while loop because the real world application will have a lot more data than four records and will by called by multiple users many times per day.
Thanks in advance!
EDIT:
It's more or less an inventory problem... I've got 100 slices of pizza and 100 people who say they want a slice of pizza. The Foo_Bar table is basically a way to assign one slice of pizza per person. The table exists and this solution will load the data for the table.