I was hoping to get some help with my SQL Server script.
Basically, I have the following requirement:
In the database we have a table called Space. A Space has a length and a width.
We need to upload data from excel sheets we receive. So I upload it into a table and this table also have a length and width.
Now, I need to get the Oid from Space (Oid, Length, Width) into the #spaceTmp table (NULL, Length, Width) but the problem is that length and width can be matched in any order.
Ex:
Space table has the following:
(1, 5, 7)
#spaceTmp has the following:
(NULL, 5, 7)
(NULL, 7, 5)
(NULL, 4, 3)
(NULL, 3, 4)
I need #spaceTmp to have:
(1, 5, 7)
(1, 7, 5)
(2, 4, 3)
(2, 3, 4)
Any advice will be appreciated.
P.S. for simplicity I’m not using GUIDs but integers for Oid column
Try this: