本文介绍了在mysql查询中选择查询作为vaule的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我有两个表tb1和tb2



tb1中有四列tb1c1,tb1c2,tb1c3,tb1c4



和tb2中的三列



tb2c1,tb2c2,tb2c3



当我是在tb1中插入值然后我想将tb2c2包含为tb1c3字段中的值



我虽然做了类似的事情:



插入 进入 tb1(tb1c1,tb1c2, tb1c3,tb1c4)' 1'' 2'选择 tb2c2 fromtb2 其中 tb1c1 = 1)





请在此查询中帮助我



我尝试过的事情:



我有两张桌子tb1和tb2



ther e是tb1中的四列tb1c1,tb1c2,tb1c3,tb1c4



和tb2中的三列



tb2c1,tb2c2,tb2c3



当我将值插入tb1然后我想将tb2c2含量作为值插入tb1c3字段



我虽然做了类似的事情:



insert into tb1(tb1c1,tb1c2,tb1c3,tb1c4) values ' 1'' 2'选择 tb2c2 fromtb2 其中 tb1c1 = 1)





请在这个查询中帮助我

解决方案


I have two tables tb1 and tb2

there are four column in tb1 tb1c1,tb1c2,tb1c3,tb1c4

and three column in tb2

tb2c1,tb2c2,tb2c3

when i am inserting values into the tb1 then I want tb2c2 containt as value into the tb1c3 field

I though to do something like follows:

insert into tb1(tb1c1,tb1c2,tb1c3,tb1c4) values('1','2',select tb2c2 fromtb2 where tb1c1=1)



please help me in this query

What I have tried:

I have two tables tb1 and tb2

there are four column in tb1 tb1c1,tb1c2,tb1c3,tb1c4

and three column in tb2

tb2c1,tb2c2,tb2c3

when i am inserting values into the tb1 then I want tb2c2 containt as value into the tb1c3 field

I though to do something like follows:

insert into tb1(tb1c1,tb1c2,tb1c3,tb1c4) values('1','2',select tb2c2 fromtb2 where tb1c1=1)



please help me in this query

解决方案


这篇关于在mysql查询中选择查询作为vaule的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-08 20:22