一个关于pb中sql语句的问题

zy2lnj 2003-08-04 12:10:27
请问大家一个简单的问题,在pb中带条件的insert语句正确的写法应该是怎么写?
我写的是:insert into "表名" ("列名1","列名2","列名3",……) values("值1","值2","值3",……) where("表名"."列名"=变量)

这样写系统总是说语法错误,请问正确的写法应该是什么?
...全文
36 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
jdsnhan 2003-08-07
  • 打赏
  • 举报
回复
大家说的很清楚了,揭贴吧!
junes8250 2003-08-07
  • 打赏
  • 举报
回复
Insert Into Table_name
( 字段1,字段2)
Values
(:变量1,:变量2)
Where 字段X= :变量1 ;
klbt 2003-08-04
  • 打赏
  • 举报
回复
INSERT INTO tablename ( Name_1,Name_2) Values ('值1','值2') ;
Jekson 2003-08-04
  • 打赏
  • 举报
回复
Oh!,Sorry! ..
Insert Into Table_name ( Name_1,Name_2) Values ('值1','值2') ;
Jekson 2003-08-04
  • 打赏
  • 举报
回复
Insert Into Table_name ( Name_1,Name_2) Values ('值1','值2')
Where ( Name_1 = :变量1 ) ;
zxthello 2003-08-04
  • 打赏
  • 举报
回复
insert 不能使用where吧,update 可以!
zzxxdd 2003-08-04
  • 打赏
  • 举报
回复
对呀,insert不能where
用update吧
arich 2003-08-04
  • 打赏
  • 举报
回复
Insert语句在主SQL语句中不能带where条件!
我想你说的可能是嵌套SQL语句中的从语句,如下
insert into table1(col1,col2,col3....) (select aa,bb,cc.... from table2 where table2.列名=变量)

fly7801 2003-08-04
  • 打赏
  • 举报
回复
liuxhrabbit观点正确,刚才没看
fly7801 2003-08-04
  • 打赏
  • 举报
回复
可以啊
如下:
ls_sql += " insert blb00000 SELECT b.name,'c',"+ls_sql1+" as quantity,0,0,0,0,'"+is_month+"','"+is_reportid+"' from babh0000 r,bach0000 a,aaa00000 b "
ls_sql += " where r.warehousecode = a.warehousecode and r.vouchertype = a.vouchertype and "
ls_sql += " r.vouchernumber = a.vouchernumber and r.checkoutmonth = a.checkoutmonth and "
ls_sql += " a.itemcode = b.code and a.checkoutmonth ="+ is_month+" and "
ls_sql += " ( a.warehousecode = '0153' ) GROUP BY b.name ORDER BY b.name ASC "
softdear 2003-08-04
  • 打赏
  • 举报
回复
Insert语句干嘛还要带条件呢?不存在这种可能性啊
liuxhrabbit 2003-08-04
  • 打赏
  • 举报
回复
Insert语句在主SQL语句中不能带where条件!
我想你说的可能是嵌套SQL语句中的从语句,如下
insert into table1(col1,col2,col3....) (select aa,bb,cc.... from table2 where table2.列名=变量)

401

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 非技术版
社区管理员
  • 非技术版社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧