Home Forums SQL Server 2005 Development Create Temporary Tables Dynamically in cursor loop RE: Create Temporary Tables Dynamically in cursor loop

  • elmerbotha, can you please provide a larger sample size, say 5 or 10 rows for two metals? Presumably in your actual data you will have several rows like this:

    Metal Result Unit of Measurement

    Pt 1.26754 %

    Pt 1.26324 %

    Pt 1.26132 %

    Pt 1.26971 %

    Pt 1 ppm

    Pt 2 ppm

    Pt 1 ppm

    Pt 1 ppm

    and you want statistics by metal by UOM?

    If you're unsure, have a quick read of the link at the bottom of Jeff Moden's post, it will help you to provide the information we need to solve your problem.

    Cheers

    ChrisM

    “Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

    For fast, accurate and documented assistance in answering your questions, please read this article.
    Understanding and using APPLY, (I) and (II) Paul White
    Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden