title: Sequelize - SQL Server - order by for association tables
body: <p>I have 3 tables such as <code>user</code>, <code>userProfile</code> and <code>userProfileImages</code>. <code>User</code> is mapping with <code>userPrfoile</code> as has many and <code>userProfile</code> is mapping with <code>userProfileImages</code> as has many.</p>
  
  <p>I need to write the <strong>order by query</strong> in <code>userProfileImages</code>, I tried as below, but no luck.</p>
  
  <pre><code>User.findById(uID, { 
  include: [
     model: sequelize.models.userProfile
     as: userProfile,
     include: [
      {
        model: sequelize.models.userProfileImages,
        as: 'profileImages',
  
      }
     ],
      order: [[sequelize.models.userProfileImages.id, "desc"]]
    // order: [["id", "desc"]] --&gt; Tried this way also no luck
  ] }
  </code></pre>
  
  <p>I am getting the result, but <code>userProfilePicture</code> table's result is not as desc.</p>
  
  <p>Kindly give the solutions</p>