Advertisement
Guest User

Untitled

a guest
Apr 19th, 2014
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. SELECT
  2. -- here are some columns straight from the subquery and some hardcoded columns like
  3. 'My company' AS CompanyName
  4. -- and here is the most important part
  5. SUM(Subq.ImportantFloatWithBigPrecision)
  6. FROM
  7. (
  8. SELECT
  9. -- Here are some simple columns fetched from table and after that:
  10. udf.GetSomeMappedValue(Value) AS MappedValueFromFunction
  11. ,ImportantFloatWithBigPrecision
  12. FROM MyVeryBigTable
  13. WHERE ImportantFloatWithBigPrecision <> 0
  14. AND(...)
  15. ) Subq
  16. GROUP BY everything except SUM(Subq.ImportantFloatWithBigPrecision)
  17. HAVING SUM(Subq.ImportantFloatWithBigPrecision)<>0
  18. ORDER BY (...)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement