User Profile

Collapse

Profile Sidebar

Collapse
Kim Nat
Kim Nat
Last Activity: Jan 12 '12, 04:25 AM
Joined: Jan 3 '12
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • [QUOTE=ck9663;36 96026]If it's a single table, you don't need to join it to itself...

    Hi CK many thanks

    It is not from single table I must need to obtain this data from two different tables with inner join. Any suggestion.

    Once again thanks
    See more | Go to post

    Leave a comment:


  • Yes I need all rows to be in one single column and I extract these rows as a part of my application requirement. I am unsure how many rows would genrate from the two tables join - it depends on sometimes 2 or 3 rows and some times may be maximum of 10 rows. Finally I want my desired outout must be in SINGLE row instead of mutilple rows....
    See more | Go to post

    Leave a comment:


  • Hi CK

    Thanks for your help on this and also the logic much detailing to me. If you see the SQL I printed the value 'XXX' is not from table it is just introduced and I do have mutiple rows the remaining data. When I use that SQL I get 'XXX' values also multiple times and also I never get different ID other than 'XXX'. So my desired result is always should be as :

    xxx john CMD 10:50:06 plk smith CMDT 10:50:29 smk chris...
    See more | Go to post

    Leave a comment:


  • Hi Rabbit
    Thanks for your reply

    It is not home work, yes the output I thought it is in XML. I did try my above SQL to use your logic and some how I got into issues when running is SSMS the code I am trying however I am still gettting those XML flags in the result.

    Here is my code after I adjusted based on your suggestion but still getting the XML flags

    Select ',','xxx',a.use rid, a.status,ISNULL (Convert(varcha r,a.time,108),'...
    See more | Go to post

    Leave a comment:


  • Hi Rabbit, I am not supposed to use XML in my requirement where as only SQL needed to generate these multiple records into one single row.
    See more | Go to post

    Leave a comment:


  • Thanks CK. I can't find how to tweak your code for my requirement, or may be I am unable to catch the logic that you had written in this code. I am not worried about TAB delimited, if I know the code for just make multiple rows of data into one single row is enough. TAB values I can obtain easily but I want the logic for getting all in one row when retrieving from SQL SERVER these multiple records.
    See more | Go to post

    Leave a comment:


  • Mutilple rows should write into one row with TAB delimited

    I am using SQL SERVER 2008 R2 and I have situation like simple select gives multiple rows from two tables with inner join. I want to get simply these mutilple rows into one single row with TAB delimited.

    Here is my simple SQL

    Select 'xxx',a.userid, a.status,ISNULL (Convert(varcha r,a.time,108),' ' ) AS TIME,a.uid
    from TABLE AS a WITH (NOLOCK)
    Inner join TABLE AS b WITH (NOLOCK) on
    a.status = b.statuscode...
    See more | Go to post
No activity results to display
Show More
Working...