Ad
  • Default User Avatar

    Fair point, though Alexander's comment about the query optimizer is worth considering as well.
    The reason I wrote a query like this as well is that if you want to change the filter from > 50 to > 10, you only need to change the number in one place here.

  • Custom User Avatar
  • Default User Avatar

    Ohhh, things are not so simple. Firstly when you search data by the condition of the range you almost always get full table scan, the second important factor is the availability of a index by the field, order of the fields in the index, type and parameters of index, the third is the implementation of a query optimizer in a concrete database.

  • Default User Avatar

    The subquery here is poor practice. Suprising this is getting best practice votes. The query forces creation of a full set of data which is then filtered on the 'outer' where. Consider these can be moved in to each query from ussales and eusales.