title: Conversion failed when converting the nvarchar value '....' to data type int in SQL Server
body: <p>I'm trying to display a list of item names alongside its respective quantities from my <code>OrderItem</code> table based on a specific <code>OrderID</code> but the query isn't working and its displaying the conversion failed error.. </p>
  
  <p>The query I've constructed successfully displays a list of <code>ItemIDs</code> with <code>quantities</code> but I want it to display the <code>ItemNames</code> instead. The problem is that it's only the <code>ItemID</code> that can be accessed in the <code>OrderItem</code> table. </p>
  
  <p>I did a bit of digging and I tried using <code>INNER JOIN</code> but I getting this error, so I'm assuming that I'm sort of on the right track? </p>
  
  <blockquote>
    <p>Conversion failed when converting the nvarchar value 'CardiVas' to
    data type int.</p>
  </blockquote>
  
  <p>Here's the query:</p>
  
  <pre><code>SELECT 
      OrderItem.ItemID, 
      SUM(OrderItem.Quantity) AS NumOfOrderItems
  FROM 
      OrderItem 
  INNER JOIN 
      Item ON Item.Name = OrderItem.ItemID, [Order] 
  WHERE 
      [OrderItem].OrderID  = [Order].OrderID
  GROUP BY  
      OrderItem.ItemID;
  </code></pre>
  
  <p>Additionally, I did a bit of digging on the conversion error and tried the methods using <code>CONVERT</code> and <code>CASE</code> below but it didn't work either and I still got the same error: </p>
  
  <pre><code>CONVERT(NVARCHAR(20), OrderItem.ItemID)
  </code></pre>
  
  <p>and</p>
  
  <pre><code>CASE(NVARCHAR(20, OrderItem.ItemID)
  </code></pre>
  
  <p>Can anyone give me a solution to this or perhaps a better way of displaying the data I require?</p>
  
  <p>If there is any additional code or info required please let me know and I'll add it to the question.</p>