例如表A,B和C 表A看起来像名字,值 表B看起来像名字,值 表C看起来像变量名,值,值 一个例子是 表A:彼得20 表B :peter 40 表C:var1 20 40 所以从这些树表中我需要填写另一张表(D)以便它看起来如此/> 就像名字,变量名(来自表C)所以在我们的例子中这将是:peter var1 现在我知道我是怎么做的可以做到这一点,但我只是想知道什么是最好的 方式,表A& B每个包含大约2300个记录,表C大约200个。这个方式 我已经去过这个内部连接表A和B那里的关键列所以 我有一个看起来像peter 20 40的填充数据集,然后我在所有 中读取了表格中2个arraylists中的变量,其中一个包含值和 包含名。然后使用binarysearch在值arraylist中找到正确的元素 (每个值对是唯一的),因此使用 作为名称arraylist的索引,最后一步是保存新记录。对于复杂的解决方案,这是一个 吗?有人提出任何建议吗? greetz PeterHi group,has anyone got any suggestions fot the best way to handle this problem, I''vegot 3 tablesfor example table A, B, and Ctable A looks like name, valuetable B looks like name, valuetable C looks like variablename, value, valuean example would beTable A: peter 20Table B: peter 40Table C: var1 20 40so from these tree tables I need to fill an other table (D) so that it lookslike name, variablename(from table C) so in our example this would be: petervar1Now I know how I can do this but I was just wondering what would be the bestway, table A & B contain about 2300 records each, table C about 200. The wayI''ve gone about this is to inner join table A and B on there key columns soI got a filled dataset wich looks like peter 20 40, then I read in allthe variables from table C in 2 arraylists, one containing the values andone containing the names. then use a binarysearch to find the right elementin the values arraylist(each value pair is unique) and thus the index to usefor the name arraylist, the last step is to save the new record. Is this ato complex solution? Anyone any suggestions?greetz Peter推荐答案如果我理解你的情况,我会让你的数据库执行 为你工作: 选择A.Column1,C.Column1 来自C 内部加入A在A.Column2 = C.Column2 内部加入B在B.Column2 = C.Column3 其中A.Column1 = B.Column1 或 选择A.Column1,C.Column1 来自A,B,C 其中A.Column2 = C.Column2 和B.Column2 = C.Column3 和A.Column1 = B.Column1 我总是和人们争论哪个会更快,但只有b $ 200 b $ b00记录,你永远不会知道它们之间的区别。 -ZorpyIf I understand your situation correctly, I would let your database do thework for you:Select A.Column1, C.Column1From CInner Join A on A.Column2 = C.Column2Inner Join B on B.Column2 = C.Column3Where A.Column1 = B.Column1ORSelect A.Column1, C.Column1From A, B, CWhere A.Column2 = C.Column2And B.Column2 = C.Column3And A.Column1 = B.Column1I argue with people all the time over which would be faster, but with only2600 records, you''d never know the difference.-Zorpy彼得, 我看了很多次你的问题但是我看不到关系,你能解释一下吗? CorPeter,I have looked more times too your question however I cannot see the relationwith VBNet, can you explain this more?Cor嗨Cor, 首先回复Zorpiedoman和你, 我不能让数据库为我工作因为我没有桌子 C,我必须根据表A生成它和BHi Cor,first to reply Zorpiedoman and also you,I can''t let the database do the work for me because I haven''t got the tableC, I have to generate it based on the tables A and B表A看起来像名字,值表B看起来像名字,值表C看起来像variablename,value,value 所以我使用vb.net来获取并插入表C中的唯一值对和 之后我使用vb.net来迁移表A& B进入一张桌子(表格D在 我之前的帖子中),所以我希望我现在清除了原来的帖子。 greetz Peter 彼得写道:一个例子是表A:彼得20 表B:彼得40 表C:var1 20 40 但是我首先必须生成表C,忘了提到 所以从这些树表中我需要填写另一个表(D)以便它看起来像名字,variablename(来自表C)所以在我们的例子中,这将是: petervar1 " Cor Ligthert" <无************ @ planet.nl>写在消息 新闻:uj ************** @ TK2MSFTNGP11.phx.gbl ...彼得, 我看了你问题的次数多了但是我看不到与VBNet的关系,你能解释一下这个吗?table A looks like name, valuetable B looks like name, valuetable C looks like variablename, value, valueSo I use vb.net to get and insert the unique value pairs in in table C andafterwards I use vb.net to migrate tables A & B into one table (table D inmy previous post), so I hope I cleared my original post now.greetz PeterPeter wrote:an example would beTable A: peter 20Table B: peter 40Table C: var1 20 40but I first have to generate the table C, forgot to mention thatso from these tree tables I need to fill an other table (D) so that itlookslike name, variablename(from table C) so in our example this would be:petervar1"Cor Ligthert" <no************@planet.nl> wrote in messagenews:uj**************@TK2MSFTNGP11.phx.gbl... Peter, I have looked more times too your question however I cannot see therelation with VBNet, can you explain this more? Cor 这篇关于避免多次选择的最佳方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-16 07:33