views:

134

answers:

3

I have 2 tables

POST (idpost, user, text) COMMENT (idcomment, idpost, text)

i want do delete all comment with post have a user like "usertest"


delete from COMMENT c join POST p on c.idpost = p.idpost
where p.user like 'usertest'

who i make this in subsonic 3???

i try something like this, but, offcourse, don't work hehehehehe


COMMENT.Delete(x => x.POST.where(y => y.user == "usertest"));
A: 

I'm not a subsonic programmer, but there is another article in StackOverflow about deleting all records in a table:

http://stackoverflow.com/questions/1333171/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.

Registered User
A: 

I Don't Use SubSonic too, but may you can try with using Triggers.

See you.

GeoAvila
+1  A: 

You should be able to do the following:

IQueryable<Person> query = from comments in Comment.All()
                           join posts in Post.All()
                             on posts.idpost equals comment.idpost
                           select comments;

Comment.GetRepo().Delete(query.ToList());
Adam