I have no idea if this is possible - and suspect it may not be.
I have a table in MS Access 2003 that lists some fields that are present in another table in the database. What I want to do is draw the data from the other table but in the select statement define the fields to draw by using the values in the first table.
For example
Table 1
[Sequence] [Name]
1 CustomerId
2 CustomerName
3 CustomerBirthday
Table 2
[CustomerId] [CustomerCode] [CustomerName] [CustomerType] [CustomerBirthday]
1 A123 Andrew A1 Aug
2 A122 Bob A2 Nov
3 A133 Charles A1 Jan
4 A153 Diane A5 Mar
Required Output, using the information defined in table 1:
1 Andrew Aug
2 Bob Nov
3 Charles Jan
4 Diane Mar
The required output could be generated as follows:
SELECT CustomerId, CustomerName, CustomerBirthday FROM Table2
However I want to be able to change the fields and so would like to do something like:
SELECT [field name in table1 Where Sequence=1], [field name in table1 Where Sequence=2], [field name in table1 Where Sequence=3] FROM Table2
I know I could do it in code, but wondering if there is a way to do it in pure SQL so I can stick it into a normal query.