473,488 Members | 2,516 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Create a table Query

4 New Member
HI,

How can I create a table form a query but that the fields in the query are transfered to the field name in the table.

Example : the query has one column field called numbers: 1 2 3 4 5

Then a table based on that query will have the fields 1 2 3 4 5 as field names so I can store data in the fields.


Thanks,
May 27 '08 #1
2 1490
Stewart Ross
2,545 Recognized Expert Moderator Specialist
Hi Libra79. This sounds very like an assignment question. If it is, please read our posting guidelines and the explicit FAQ on homework questions for our site rules. I can provide some guidance as to how to approach this problem, but working on the assumption that what you ask is indeed a homework question you will understand that I cannot provide a solution for you.

Your requirement is to 'pivot' the row data to become columns in a new table. There is no one step way to do this. However, it is possible by doing the following:

create a dummy crosstab query using your numbers field several times, once as a row source, once as a column header, and once as a calculated field in a dummy capacity (it does not matter much what calculation is involved - but if you wish to retain the data type correctly you should use max or min).

This will give you the same number of rows, with the column headings being the values.

Create a new query based on your crosstab query, selecting only the column header fields. Make this query a create table query and run it to create a new table which will have the correct column headings, but of course contain the dummy totals from the first query.

Finally, delete the row data from the new table and enter whatever values you need in your new table.

I hope this provides sufficient guidance without in any way doing the work for you.

-Stewart

ps I have linked two screenshots, one showing a table called numbers storing text values, and the other the result of the create table crosstab before deletion of the row data.
Attached Images
 
Attached Images
File Type: jpg ScreenHunter_42.jpg (10.0 KB, 185 views)
May 28 '08 #2
Libra79
4 New Member
Hi,

Thanks this helped a lot.

And it's actually not a homework. I am developing a database that has fields related to features for an automobile business.I needed to do this so for every feature I can start saving data from the production lines but I had the info on a table as stored data and I needed it to be as a table to store the data based on that info.

Thanks,


Hi Libra79. This sounds very like an assignment question. If it is, please read our posting guidelines and the explicit FAQ on homework questions for our site rules. I can provide some guidance as to how to approach this problem, but working on the assumption that what you ask is indeed a homework question you will understand that I cannot provide a solution for you.

Your requirement is to 'pivot' the row data to become columns in a new table. There is no one step way to do this. However, it is possible by doing the following:

create a dummy crosstab query using your numbers field several times, once as a row source, once as a column header, and once as a calculated field in a dummy capacity (it does not matter much what calculation is involved - but if you wish to retain the data type correctly you should use max or min).

This will give you the same number of rows, with the column headings being the values.

Create a new query based on your crosstab query, selecting only the column header fields. Make this query a create table query and run it to create a new table which will have the correct column headings, but of course contain the dummy totals from the first query.

Finally, delete the row data from the new table and enter whatever values you need in your new table.

I hope this provides sufficient guidance without in any way doing the work for you.

-Stewart

ps I have linked two screenshots, one showing a table called numbers storing text values, and the other the result of the create table crosstab before deletion of the row data.
Jun 2 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
2110
by: dawnunder | last post by:
eg. Someone fills out 3 fields. (There will be more but this is just to give you an idea) 1. Country? 2. State? 3. City I want this script to generate a web page and list the people by
5
3020
by: lkrubner | last post by:
I have a webserver through Rackspace. I create a domain. I create an FTP user. I upload some files. I create a database called testOfSetupScript and then I create a database user named setup. I...
6
12257
by: Bruce | last post by:
I want to create a new table based on an existing table, but I don't want the tables to have any enforced relationship. Is this possible without having to do a CREATE TABLE and an INSERT? ...
3
13809
by: Peter Phelps | last post by:
My problem is as follows: I need automatically iterate through a single field in a table and use the values in the field to create an in-statement. Currently, the character limitation in the...
10
3041
by: Mark | last post by:
I have a table about people containing 25 fields. The table contains the usual fields - first, last, address, city, state and zip. There is no primary key. These fields all have data with the...
1
2612
by: rdemyan via AccessMonster.com | last post by:
My application has a table that contains information on buildings. The building data comes from another database and is imported from a spreadsheet into my application. Originally, I thought...
8
3462
by: chrisdavis | last post by:
I'm trying to filter by query or put those values in a distinct query in a where clause in some sort of list that it goes through but NOT at the same time. Example: ROW1 ROW2 ROW3 ROW4 ,...
4
12411
by: etuncer | last post by:
Hello All, I have Access 2003, and am trying to build a database for my small company. I want to be able to create a word document based on the data entered through a form. the real question is...
3
18677
by: creative1 | last post by:
Here is how you create a complex data report that involves parent and child commands and you can update information at runtime. Its pretty straight forward to work with simple queries; however,...
24
2850
by: Dan2kx | last post by:
Hello to all that read and thank you to all that post Background: I have been tasked to create a holiday database for the employees in my lab, (so expect many more posts) im stuck at the first...
0
7142
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7181
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7352
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5445
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4565
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3071
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1383
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
618
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
272
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.