Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

7
  • In what way would this help performance? Commented Dec 2, 2011 at 13:34
  • This will not even work. No row can have f.field equal to both 'Date' and 'Amount' Commented Dec 2, 2011 at 13:39
  • I don't thinks this is a correct SQL query. This one will return just Date and Amount rows. I need all document fileds for those documents which satisfy my filter criteria. Commented Dec 2, 2011 at 13:42
  • @JNK- I've eliminated two subqueries...the performance benefit should be obvious. With the mish-mash of datatypes in the Fields table (and assuming a database redesign isn't going to happen) I think this should do a fair job of reaching the goal here. Commented Dec 2, 2011 at 13:45
  • @ypercube- If you look, the f.Field checks in the WHERE clause are in different parts of an "OR". Commented Dec 2, 2011 at 13:47