title: Dynamics AX 2012 Subquery in a View
body: <p>AX allows you to enter basic SQL into View ranges.  For example, in an AOT view's range, for the match value, you could enter (StatRepInterval.Name == 'Weekly').  This works nicely.</p>
  
  <p>However, I need to do a more advanced lookup on a View, using a subquery.  Can anyone suggest a way to do this? </p>
  
  <p>This is what I would like to use, but I receive an error: "Query extended range failure: Syntax error near 34."</p>
  
  <p>(StatRepInterval.Name == (SELECT FIRSTONLY StatRepInterval.Name FROM StatRepInterval WHERE StatRepInterval.PrintDirection == 1 ORDER BY StatRepInterval.Name DESC))</p>
  
  <p>I've tried a lot of different variants of the subquery, from straight T-SQL to X++ SQL, but nothing seems to work. </p>
  
  <p>Thanks for the help.</p>