Replicate records "n" times from value in table

  • Thread starter Thread starter Christo Swart
  • Start date Start date
C

Christo Swart

How do I replicate a record in a table "n" times based on a value ("n") in
another table?

Christo Swart
 
You might create a third table (say, named "Positive Integers") with at
least "n" records, with at least one field (say, named "Value") in which
each record contains one unique positive integer (that is "integer" in the
mathematical sense -- you might want to use the Long Integer data type in
the table) from 1 to n, as in:

Value
1
2
3
..
..
..
n

You might then use this table in a query whose SQL looks something like
this:

SELECT
[Your Table].*
FROM
[Positive Integers],
[Your Table] INNER JOIN [Your Other Table]
ON [Your Table].[Your Linking Field] = [Your Other Table].[Your Linking
Field]
WHERE
[Positive Integers].[Value] <= [Your Other Table].[n]
 
Back
Top