January 22, 2025 at 8:57 am
Hi all,
I hope someone can help with advice. What would be the best approach to create an output for the below scenario. If I have a table with an assessment code and description and I would then like to populate every occurence of assesementcode / description with a mark system of say 1 to 10
Thanks In advance.
January 22, 2025 at 11:34 am
You could do something like this
SELECT src.AssessmentCode, src.AssessmentDescriptio, m.Mark
FROM YourSchema.YourTable AS src
CROSS JOIN (VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10)) AS m(Mark)
January 23, 2025 at 2:27 am
It's actually got a name for that type of process... "Relational Multiplication". The code that Des Norton wrote above will absolutely do the trick. It's also known as a "Cartesian Product" in this case.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply