Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Multiple Grouping for ad-hoc Table

$
0
0

Hi,

I want to write a T-SQL script to group "Field1" and "New Field2" columns in such a way to make them look like Table2 in the below snapshot.
The elements in "Field1" must be regenerated according to the occurrence of "New Field2" values.
The following is sample that illustrate the results:

Results

Any suggestions or opinions about how to write this script?
Note that I want to run this script to a large number of rows what is shown is just a sample.

Thanks in Advance

Tarek Faraj





Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>