title: Merging multiple Firebase Snapshot Data in the same tableView
body: <p>In my App I want to show a feed which generates a tableView depending on which groups the user subscribed. In the background two Firebase request are done and then converted to a tableView.
  My Code shows the content correct. But there are two issues. The order is wrong. It should be 4-&gt;3-&gt;2-&gt;1 (based on timestamp) and right now it is random. Also if I click on a comment the didSeleceRowAt works totally wrong.
  How can I manage to put the result in the same tableView correctly?</p>
  <pre><code>func datenBankAbfrage() {
  
      ref = Database.database().reference().child(&quot;placeID/h77e24d95a5479ed7588&quot;)
      ref.queryOrdered(byChild: &quot;userTime&quot;).queryLimited(toLast: 10).observe(
          DataEventType.value,
          with: { (snapshot) in
  
              self.ref = Database.database().reference().child(
                  &quot;placeID/vh-b83b6e4475e04e3fbaa647d23b&quot;)
              self.ref.queryOrdered(byChild: &quot;userTime&quot;).queryLimited(toLast: 10).observe(
                  DataEventType.value,
                  with: { (snapshot2) in
  
                      for video in snapshot.children.allObjects as! [DataSnapshot] {
                          let Object1 = video.value as? [String: AnyObject]
  
                          let userName = Object1?[&quot;userName&quot;]
                          let userGroup = Object1?[&quot;userGroup&quot;]
                          let userComment = Object1?[&quot;userComment&quot;]
                          let userTime = Object1?[&quot;userTime&quot;]
                          let userLikes = Object1?[&quot;userLikes&quot;]
                          let commentId = Object1?[&quot;commentId&quot;]
  
                          ViewComments.commentIDNew = commentId as! String
                          let video = importComment(
                              userName: userName as! String, userGroup: userGroup as! String,
                              userComment: userComment as! String, userTime: userTime as! Int,
                              userLikes: userLikes as! Int, commentId: commentId as! String)
                          self.table.insert(video, at: 0)
                          // self.table.append(video)
                          self.tableView.reloadData()
                      }
  
                      for video in snapshot2.children.allObjects as! [DataSnapshot] {
                          let Object2 = video.value as? [String: AnyObject]
                          let userName = Object2?[&quot;userName&quot;]
                          let userGroup = Object2?[&quot;userGroup&quot;]
                          let userComment = Object2?[&quot;userComment&quot;]
                          let userTime = Object2?[&quot;userTime&quot;]
                          let userLikes = Object2?[&quot;userLikes&quot;]
                          let commentId = Object2?[&quot;commentId&quot;]
                          ViewComments.commentIDNew = commentId as! String
                          let video2 = importComment(
                              userName: userName as! String, userGroup: userGroup as! String,
                              userComment: userComment as! String, userTime: userTime as! Int,
                              userLikes: userLikes as! Int, commentId: commentId as! String)
                          self.table.insert(video2, at: 0)
                          // self.table.append(video)
                          self.tableView.reloadData()
                      }
                  })
          })
  }
  
  </code></pre>
  <pre><code>class importComment {
      var userName: String?
      var userID: String?
      var userGroup: String?
      var userComment: String?
      var userTime: Int?
      var userLikes: Int?
      var commentId: String?
  
      init(
          userName: String?, userGroup: String?, userComment: String?, userTime: Int?,
          userLikes: Int?, commentId: String?
      ) {
          self.userName = userName
          self.userGroup = userGroup
          self.userComment = userComment
          self.userTime = userTime
          self.userLikes = userLikes
          self.commentId = commentId
      }
  
  }
  
  </code></pre>
  <img src="https://i.stack.imgur.com/qi6UN.png" width="300" height="500">