insert into trainstation(trainID,stationID,arriveTime,startTime,runTime,distance,hard_seat,soft_seat,hard_sleep,soft_sleep) values('1043',select stationID from station where stationName ='奎屯','11:08','终点站','37小时43分','2810','143','-','280/291/303','469/492')
这个要怎么改才对啊stationID这个字段数据是另外张表查的
这个要怎么改才对啊stationID这个字段数据是另外张表查的
加个括号就行了,但要保证返回结果是一条记录,其它的语法我没看
这个SQL查出来的值可能不只一条,LZ这样写当然不对LZ试试分开写SQL把,先写select stationID from station where stationName ='奎屯'获取ID,如果ID只有一个,就把ID作为参数执行insert
insert into trainstation(trainID,stationID,arriveTime,startTime,runTime,distance,hard_seat,soft_seat,hard_sleep,soft_sleep) select stationID '1043','11:08',..... from station where stationName ='奎屯'