撰写“插入...选择...位置"询问

编程入门 行业动态 更新时间:2024-10-09 18:16:04
本文介绍了撰写“插入...选择...位置"询问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试使用 Slick 3.0 编写查询,但似乎无法弄清楚.

I'm trying to compose a query using Slick 3.0, but can't seem to figure it out.

等效的 SQL 是insert into SavedMail select * from Inbox where Inbox.id = 1"

The equivalent SQL is "insert into SavedMail select * from Inbox where Inbox.id = 1"

val mailTable = TableQuery[Tables.Inbox] val savedMailTable = TableQuery[Tables.Savedmail] val select = mailTable.filter(_.id === msgId)

我现在被困在如何进行插入上.感谢帮助.

I'm stuck on how to do the insert now. Help appreciated.

推荐答案

这是我想出的解决方案.也许有一种不使用 forceInsertQuery 的方法,但是嘿,这行得通.

Here's a solution I've come up with. Perhaps there's a way to not use forceInsertQuery, but hey, this works.

val mailTable = TableQuery[Tables.Inbox] val savedMailTable = TableQuery[Tables.Savedmail] val select = mailTable.filter(_.id === msgId).map(c => (c.id, c.touserid, c.fromuserid, c.mailtype, c.subject, c.msg, c.postdate)) val q = savedMailTable.map(c => (c.id, c.touserid, c.fromuserid, c.mailtype, c.subject, c.msg, c.postdate)) forceInsertQuery select

更多推荐

撰写“插入...选择...位置"询问

本文发布于:2023-11-25 11:54:45,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1629640.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:位置   quot

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!