SQL Recipes
A FREE cookbook for SQL queries and examples
Register FAQ Search Today's Posts Mark Forums Read

SQL - Questions and Answers Have a SQL question? Post it here. First do a search to see if someone hasn't already answered it.

Go Back   SQL Recipes a FREE cookbook of SQL queries and examples > SQL queries and examples > SQL - Questions and Answers

Reply
 
LinkBack Thread Tools Search this Thread
  #1 (permalink)  
Old 08-13-2008, 07:53 PM
Unregistered
 
Posts: n/a
Default ANY dialect question:

Rows to String


I have a database that I am trying to turn row records into a string.
For example, the records look like this

R# ID# Bg Dt Ed Dt Cde
1 1001 1/1/07 2/5/07 H
2 1001 2/5/07 5/5/07 P
3 1001 8/7/07 10/1/07 S
4 1002 2/1/07 3/4/07 P
5 1002 5/1/07 6/2/07 J
6 1002 6/2/07 7/7/07 P

and would like to get a query result that looks like this:
1001 HP0S
1002 P0JP
where zeros indicate that the time is not continuous, or gap in service.

I looked at concatenating rows...but I don't think that is exactly what I need. Any suggestions?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

ANSWER(S):

  #2 (permalink)  
Old 08-18-2008, 12:36 PM
AVANTHI
 
Posts: n/a
Thumbs up ANY answer. Re: Rows to String

Quote:
Originally Posted by Unregistered View Post
I have a database that I am trying to turn row records into a string.
For example, the records look like this

R# ID# Bg Dt Ed Dt Cde
1 1001 1/1/07 2/5/07 H
2 1001 2/5/07 5/5/07 P
3 1001 8/7/07 10/1/07 S
4 1002 2/1/07 3/4/07 P
5 1002 5/1/07 6/2/07 J
6 1002 6/2/07 7/7/07 P

and would like to get a query result that looks like this:
1001 HP0S
1002 P0JP
where zeros indicate that the time is not continuous, or gap in service.

I looked at concatenating rows...but I don't think that is exactly what I need. Any suggestions?
q
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 12:13 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
Copyright (c) 2006-2008 SQL Recipes

1 2 3 4 5 6 7 8