Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to merge (REMEMBER merge not combine!) these two queries
    primarykey
    data
    text
    <p>I have these two linq queries:</p> <pre><code>var combo1 = from c in db.comments join p in db.picture on c.targetpictureid equals p.idpictures join u in db.users on c.iduser equals u.iduser select new TCommentDTO { idcomments=c.idcomments, comment1 = c.comment1, targetpictureid = c.targetpictureid, ctime = c.ctime, iduofpic=p.iduser, iduofcommentor=c.iduser, profilepicofcommentor=u.profilepic, usernameofcommentor=u.username, picFilename=p.picFilename, picTitle=p.picTitle }; var combo2 = from f in db.followers join u in db.users on f.iduser equals u.iduser select new TfollowerDTO { idfollowers = f.idfollowers, iduser = f.iduser, targetiduser = f.targetiduser, startedfollowing = f.startedfollowing, unoffollower = u.username, ppoffollower = u.profilepic, status = u.status }; </code></pre> <p>I am using web API that returns JSON. I want to merge the output of these two queries. </p> <p>I want to rewrite this code in such a way that comments and follower data should be merged (not combined) with respect to time based on <code>ctime</code> and <code>startedfollowing</code>. If a user has a new comment, the comment should come first and if the follower is first, the follower data should come first.I can not use Union() and Concat() because firstly both classes have different members and secondly i dont want both json object to be combined. </p> <p>Something like this: </p> <pre><code>{ //comments data }, { //follower data}, { //comments data }, { //comments data }, { //comments data }, { //follower data} </code></pre> <p>So how to do this task?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload