使用 2 个表连接和 wheres 进行删除
我有 2 个表,
POST (idpost, user, text)
COMMENT (idcomment, idpost, text)
我想删除帖子中包含“usertest”这样的用户的所有评论,
delete from COMMENT c join POST p on c.idpost = p.idpost
where p.user like 'usertest'
我该如何在 subsonic 3 中执行此操作?
我尝试过类似的方法,但是,当然,它不起作用,
COMMENT.Delete(x => x.POST.where(y => y.user == "usertest"));
I have 2 tables,
POST (idpost, user, text)
COMMENT (idcomment, idpost, text)
I want to delete all comments with post that have a user like "usertest",
delete from COMMENT c join POST p on c.idpost = p.idpost
where p.user like 'usertest'
How do I do this in subsonic 3?
I tried something like this, but, off course, it doesn't work,
COMMENT.Delete(x => x.POST.where(y => y.user == "usertest"));
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您应该能够执行以下操作:
You should be able to do the following:
我不是亚音速程序员,但 StackOverflow 中有另一篇关于删除表中所有记录的文章:
如何使用 SubSonic 3 删除表中的所有记录
这似乎是一个很好的起点,但这只是一个猜测。
I'm not a subsonic programmer, but there is another article in StackOverflow about deleting all records in a table:
How to delete all records in a table using SubSonic 3
It seemed like this might be a good starting place, but that's just a guess.