Search code examples
c#subsonicsubsonic3delete-record

Delete using 2 tables join and wheres


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"));

Solution

  • 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.