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')
精彩评论