Ms-access – SQL MS ACCESS: Split row into multiple based on column value

ms accessms-access-2010

I have table (SQL MS ACCESS)

COUNTRY   NO_OF_PAGES
FRANCE    2 
UK        4
GERMANY   1

I want output

COUNTRY   NO_OF_PAGES
FRANCE    1
FRANCE    2
UK        1
UK        2
UK        3
UK        4
GERMANY   1

Best Answer

I create number table which contain value from 1 to 10,you may populate it with more as per your requirement.

Table name tblNumber (RowNumber number)

SELECT country, rownumber
FROM tblNumber AS N INNER JOIN table3 AS t ON n.rownumber<=t.noofpages;

here table3 is your table.