• Brad Marsh (3/7/2013)


    No So what I mean by comments is the comments field in the SQL.

    So all of this data I have is created by customers, and because of that there is no static or same comment ever made in the comments, they are rather unique for that reason I can't add it as predefined data as suggested in the examples.

    This all needs to be done dynamically, no to mentions there is well over 3K rows and will be ever growing.

    Does this make any sense?

    Nope. Why did you provide this as a sample if it was inaccurate? The code provided was based on your sample.

    Here is a small subset of the select to give you an idea of what I mean.

    CaseID: Comments: Userlogin

    1243546457 Great help UserA

    3123234353 AWESOME UserB

    2131314242 Support was terrible UserC

    2131314242 Support was terrible UserC

    2131314242 Support was terrible UserC

    2131314242 Support was terrible UserA

    3453453453 Could have been better UserB

    note the item in bold, this is the variable I need to consider.

    Of course, your sample also has fewer columns of data than your query. Take what was provided and adjust it to suit your needs. If you have problems, post back and be sure to provide better sample data. Also, look at how the code provided was posted. It included the ddl (in this case I used a table variable, you could always use a temporary table or permanent table instead), sample data as insert statements. You can easily cut./paste/run the code to see how it works.