• dwilliscp (7/25/2014)


    I have a massive table (company, plant, resource, part number) that I need to create a from part number, to part number for every part within "Company, Plant, Resource" combo.

    Trying to figure out what the best method would be.. using a cursor will put the load on one CPU and take way too long.

    Ideas?

    SELECT company, plant, resource, MIN(partno) as [from part number], MAX(part number) as [to part number]

    FROM table

    GROUP BY company, plant, resource


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]