Idmpc
Programmer
- Jun 25, 2008
- 16
Hi everyone
So, I was developing this database for someone, but now it needs an upgrade. They want me to add a field (lets call it NEWFIELD) to an already existing table, however, that field will need to store some information that's not present on the database. Also, the database is already filled with data, so creating a new one would take a very long time.
Here's an example:
I have a database with a table called TABLE1
That table has 2 fields: FIELD1 and FIELD2
I need to add a new field, called NEWFIELD
Now, here's the complex part of it:
I have a file with me with the following data
However, on my existing database (TABLE1), field FIELD1 has a "C" value already, here's an example of my current existing database:
What I need is for my NEWFIELD to hold the "name" that contains the "C" value for each record, for example, the new table would look like this:
What I really want is to create a table for that file I have (NAME1 has C1, C2, C3...), so that when I use a SQL query, I can somehow check the C value on FIELD2 of TABLE1 and bring the correct NAME value for it.
Also, I need my table that contains the file information (NAME1 has C1, C2, C3...) to be "Updateable", i mean, I want to be able to add new "NAME" values with new "C"s on it.
I imagine that creating a table for each "NAME" value, and storing all the "C"s that name has is hardly the right way to go...
Can anyone help me?
Thank you very much!
PS.: If this post is too confusing, please don't hesitate to ask questions and I'll try to explain it the best I can!
So, I was developing this database for someone, but now it needs an upgrade. They want me to add a field (lets call it NEWFIELD) to an already existing table, however, that field will need to store some information that's not present on the database. Also, the database is already filled with data, so creating a new one would take a very long time.
Here's an example:
I have a database with a table called TABLE1
That table has 2 fields: FIELD1 and FIELD2
I need to add a new field, called NEWFIELD
Now, here's the complex part of it:
I have a file with me with the following data
Code:
NAME CONTAINS
NAME1 C1, C2, C3, C4, C5, C6
NAME2 C7, C8, C9
However, on my existing database (TABLE1), field FIELD1 has a "C" value already, here's an example of my current existing database:
Code:
TABLE1
FIELD1 FIELD2
A C1
B C7
C C7
D C3
What I need is for my NEWFIELD to hold the "name" that contains the "C" value for each record, for example, the new table would look like this:
Code:
TABLE1
FIELD1 FIELD2 NEWFIELD
A C1 NAME1
B C7 NAME2
C C7 NAME2
D C3 NAME1
What I really want is to create a table for that file I have (NAME1 has C1, C2, C3...), so that when I use a SQL query, I can somehow check the C value on FIELD2 of TABLE1 and bring the correct NAME value for it.
Also, I need my table that contains the file information (NAME1 has C1, C2, C3...) to be "Updateable", i mean, I want to be able to add new "NAME" values with new "C"s on it.
I imagine that creating a table for each "NAME" value, and storing all the "C"s that name has is hardly the right way to go...
Can anyone help me?
Thank you very much!
PS.: If this post is too confusing, please don't hesitate to ask questions and I'll try to explain it the best I can!