Using Join() for fields of a table ?

  • Hey ... can we use Join() for Fields of a table also ?

    I have a table where I get customer details like Username,LastName,FirstName,EmailID,Country,Station,Product.

    Here, Station and Product can have multiple values. A customer can be mapped to 1 or more than 1 station and product.

    Currently my report is designed to display the report with multiple rows for single customer.

    Say I have a cusotmer who has stations as 'AS', 'PL' and Product as 'po','X3m','ol9'

    My report displays 5 rows for this data.

    I need to show everything in a single row avoiding duplicating of rows.

    How can i use join() here?

    I want to have the report like:

    CustomerName. ----- Country Station Product

    Cust1 XX AS,PL po,X3M,ol9

    How can i achieve this ?

    With Regards,
    Anu..;-):hehe:

  • You can do it with a for xml structure.

    Check out this article:

    http://www.sqlservercentral.com/articles/FOR+XML+PATH/70203/


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply