| Author |
Topic |
|
JJins
Yak Posting Veteran
81 Posts |
Posted - 2010-11-17 : 16:21:45
|
| I have three tables......here are the fields to each table.Table 1PK programID,FK ApplicaionID, COmpanyID, State, Description, FK OccupancyTypeID, FK PolicyType,DCmin, DCMax, FK ConstructionType.Table 2FK ApplicationID, FK ProgramID, FKCoverageID, limitmin, limitmax, rate, PCMIN, PCMax, territoryTable 3 holds tables but the fields are not relational.StateID (which i would like to link to Table1 State), LimitMin, limitmax, f1, m1, f6, m6,f9, m9, TerrIDNow here is the fun part! I want to insert numbers that are under f1, m1, f6, m6,f9, m9, into the rate field of table1. But a lot of things need to line up for that insert to happen. here they are.If state(table1)=Stateid(table3) and limitmin(table2)&limitmax(table2) match that of table3,if constructiontype(table1)= f and PCmin(table2)= 1and territory(table2)=TerrID(Table3)With that being true it would insert the number under f1 from (table3) into the blank rate field of table2.when all those variable match up I want it to insert the number that is under f1 or m1 or f6 or m6 or f9 or m9 and insert it into table2 in the rate field.Anyone know how to do this????ha it is a hard one! Thank you in advance for the help.Best,GG |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2010-11-17 : 17:17:16
|
quote: Now here is the fun part! I want to insert numbers that are under f1, m1, f6, m6,f9, m9, into the rate field of table1
That will indeed be fun since you didn't include a Rate field in your description of Table1. It's also difficult to post multiple values in a single column, unless you post them as a concatenated string, and that's not a recommended practice.quote: Table 3 holds tables but the fields are not relational.
I have no idea what this means. A table cannot hold another table.By the way, are you really naming your tables Table1, Table2, etc.? If not, please post the actual table names. If you are, please stop, and give them names that describe what data they hold.Also post the actual DDL for the tables, e.g.CREATE TABLE Table1 (ProgramID int NOT NULL PRIMARY KEY, ApplicationID int NULL, ...)Lastly you're using the term "insert" when it sounds like you mean "update" or "change" or "modify", please clarify this. INSERT means to add new rows to a table, not change existing rows. |
 |
|
|
|
|
|