Quite simple but I dont get it. Any Solution?

很简单,但我不明白。任何方案?

For example: if there is 2 times the name peter. But you should insert both.

例如:如果有2倍的名字彼得。但你应该插入两者。

insert into table1 (id,firstname,zip) values ('%s',(select nametable from table2 where name='peter'),'1234');

I hope its understandable

我希望它可以理解

Edit: you get the id.. i just changed it...

编辑:你得到了身份证......我刚改变了......

I want to insert something where I have to select from another table. But the problem is sometimes i get more than 1 result. If there is more than 1 result I want to insert all results.

我想插入一些我必须从另一个表中选择的东西。但问题是有时我得到的结果超过1。如果结果超过1,我想插入所有结果。

1 个解决方案

#1


insert into table1 (id, name, zip) ...

And what would you like to insert into it?

你要插入什么?

... select id, nametable, '1234'
from table2 
where name='peter'

Now you connect those 2 pieces and it should work

现在你连接这2件,它应该工作

更多相关文章

  1. 要在SQL数据库中根据身份证号码查询出性别(有15位的,也有18位的),怎
  2. android 识别身份证
  3. 用户的身份证号和手机号验证

随机推荐

  1. Android中一些比较好的开源代码项目
  2. Android(安卓)Service的启动流程源码分析
  3. 【Android】安卓中常用的图片加载方法
  4. android monkeyrunner 1
  5. Android应用程序组件Content Provider应
  6. Android获取设备状态栏status bar高度的
  7. What is Android?
  8. android 中 系统日期时间的获取
  9. android圆形进度条ProgressBar颜色设置
  10. andriod item内checked的setOnClickListe