title: DynamoDB - How to get all items with any partition key, but with a range of sort key values?
body: <p>I've got a DynamoDB table with a bunch of pokemon in it, heehee, and I'm trying to get them out ordered by level.</p>
  <p>I've got a GSI with pokemon (the name, pikachu, etc) as the partition key, and level (number value) as the sort key.</p>
  <p>I want to query everyone over a certain level. Here's my code:</p>
  <pre><code>db.query({
    TableName: &quot;pokemon&quot;,
    IndexName: &quot;level&quot;,
    KeyConditionExpression: `lv &gt; :zero`,
    ExpressionAttributeValues: {
      &quot;:zero&quot;: 0
    }
  }, function (error, reply) {
    return console.log(error || reply)
  })
  </code></pre>
  <p>And I get this error</p>
  <p><code>ValidationException: Query condition missed key schema element: pokemon</code></p>
  <p>I've also tried this</p>
  <pre><code>db.query({
    TableName: &quot;pokemon&quot;,
    IndexName: &quot;level&quot;,
    KeyConditionExpression: `pokemon = not_null and lv &gt; :zero`,
    ExpressionAttributeValues: {
      &quot;:name&quot;: 'not_null',
      &quot;:zero&quot;: 0
    }
  }, function (error, reply) {
    return console.log(error || reply)
  })
  </code></pre>
  <p>And get this error:</p>
  <p><code>ValidationException: Invalid condition in KeyConditionExpression: Multiple attribute names used in one condition</code></p>
  <p>I can't seem to take any value for the partition key. It keeps yelling at me : (</p>