title: redshift select distinct returns repeated values
body: <p>I have a database where each object property is stored in a separate row. The attached query does not return distinct values in a redshift database but works as expected when testing in any mysql compatible database. </p>
  
  <pre><code>SELECT DISTINCT distinct_value 
  FROM
  ( 
    SELECT
      uri,
      ( SELECT DISTINCT value_string 
        FROM `test_organization__app__testsegment` AS X 
        WHERE X.uri = parent.uri AND name = 'hasTestString' AND parent.value_string IS NOT NULL ) AS distinct_value 
    FROM `test_organization__app__testsegment` AS parent 
    WHERE     
      uri IN ( SELECT uri 
               FROM `test_organization__app__testsegment` 
               WHERE name = 'types' AND value_uri_multivalue = 'Document'
             )
  ) AS T 
  WHERE distinct_value IS NOT NULL
  ORDER BY distinct_value ASC
  LIMIT 10000 OFFSET 0
  </code></pre>