开发者

sqlite Insert statement value contains select clause : is it possible

I want to insert the records that time want to get the visitNo from other table & execute.only o开发者_如何学JAVAne fileds.

We can do it in separate separate query(that means getting visitNo from table & passing to other(insert) query).But I want to do it one query.without writting two query.

  INSERT INTO  wmVisitHeader (VisitNumber, ExecutiveCode, BusinessUnit, RouteCode, StartTime, UploadedBy, VisitDate, TerritoryCode) 
  VALUES(Select NextVisitNo from WMTransactionControl,'TEST001','MASS','VRT002','11:15' ,'TEST001','8/25/11 11:15' ,'0001')

like this ... i want...


Try this:

INSERT INTO  wmVisitHeader (VisitNumber, ExecutiveCode, BusinessUnit, RouteCode, StartTime, UploadedBy, VisitDate, TerritoryCode) 
VALUES((Select NextVisitNo from WMTransactionControl),'TEST001','MASS','VRT002','11:15' ,'TEST001','8/25/11 11:15' ,'0001')
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜