Yes, by using a theta join between an integers table and your subscriptions table.
By submitting your personal information, you agree that TechTarget and its partners may contact you regarding relevant content, products and special offers.
If you don't already have an integers table (it does come in handy for so many uses), create one like this:
create table integers (i integer); insert into integers (i) values (0); insert into integers (i) values (1); insert into integers (i) values (2); ... and so on until you have enough values
The number of integers you need in the table must be as large as the largest term value in the Subscriptions table. Then your query is:
select SubscriberName from integers inner join Subscriptions on i between 1 and term
How this works is that each row of the integers table will be matched against a row in the Subscriptions table, based on the integer value i being between 1 and the number in term. So if John Stuart's term is 25, then there will be 25 rows of the integers table that match this row. Hence the query will return the SubscriberName John Stuart 25 times.
Dig Deeper on SQL Server Database Modeling and Design
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.