[求助]SQL语法问题

艾勒伯格 2015-10-07 05:57:29
表一 order 表中有id,username,productid,price,count,totalprice这几个字段
表二 cart 表中也有id,username,productid,price,count,totalprice这几个字段
请问如何写一个SQL语句把cart 中名字为zhangsan的内容插入到order表中?
...全文
107 1 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
艾勒伯格 2015-10-07
  • 打赏
  • 举报
回复
public class ShoppingCartToOrder { public boolean moveToOrder(String username) { boolean result=false; Connection con = DBConnector.getConnection(); try { PreparedStatement ps = con.prepareStatement(""); ps.setString(1, username); if (ps.executeUpdate() > 0) { result = true; } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return result; }

22,301

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server 疑难问题
社区管理员
  • 疑难问题社区
  • 尘觉
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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