本文介绍了撰写“插入...选择...位置"询问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用 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更多推荐
撰写“插入...选择...位置"询问
发布评论