473,378 Members | 1,639 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

put 2 lines into 1 column

IHello,

I've a table like this (location withprobably more than i ip address) :

NAME IP_ADDRESS
host1 1.1.x
host1 1.2.x
host2 2.1.x
host2 2.2.x
host3 3.x
host4 4.x

and try to get this output (but only with db2, not with awk, sed or sth
similar nice UNIX tool) :

host1 1.1.x 1.2.x
host2 2.1.x 2.2.x
host3 3.x
host4 4.x

I' am really struggling but didn't found a solution yesterday evening
.... :-(

--
Toralf Förster
pgp key 0x7DB69DA3
Apr 10 '08 #1
2 1449
Toralf Förster wrote:
IHello,

I've a table like this (location withprobably more than i ip address) :

NAME IP_ADDRESS
host1 1.1.x
host1 1.2.x
host2 2.1.x
host2 2.2.x
host3 3.x
host4 4.x

and try to get this output (but only with db2, not with awk, sed or sth
similar nice UNIX tool) :

host1 1.1.x 1.2.x
host2 2.1.x 2.2.x
host3 3.x
host4 4.x

I' am really struggling but didn't found a solution yesterday evening
... :-(
Download my "SQL on Fire" slides from the web (google). There is a PIVOT
and an UNPIVOT example.

Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Apr 10 '08 #2
jefftyzzer wrote:
On Apr 10, 1:07 am, Toralf Förster <toralf.foers...@gmx.dewrote:
Toralf:

I adapted the following SQL from Anthony Molinaro's _SQL Cookbook_.
See if it helps you. Incidentally, I can't say enough good things
about Serge's "SQL on Fire" presentations--you really should get them
(go here: http://www.iiug.org/waiug/present/Fo...orum2006.html).

Regards,

--Jeff
Thanks Jeff, I'use that method.

--
Toralf Förster
pgp key 0x7DB69DA3
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Jay Chan | last post by:
I am trying to use a command line program to run a stored procedure that generates output in a comma-delimitted format. Somehow, ISQL or OSQL always wrap the lines at 256 characters. I believe this...
1
by: Chris | last post by:
Via a TCP/IP socket, I receive two lines of comma separated text. The first line is always the titles of all the columns. The subsequent line is the data for each column. How do I split out the...
7
by: Astra | last post by:
Hi All Can you please help me with a few queries on adding a header line and padding rows out. I apologise profusely for not providing the DDL for this, but I don't have it. All I have is...
5
by: KitKat | last post by:
Right now at work, I get forms e-mailed to me in an Excel chart with a serial number in one column and a new expiration date for a device's trial period in another column. For a while, when...
3
by: Alan T | last post by:
I want to display 2 lines in a column of a listview. eg. in the second column to display John Mary Can I do that?
42
by: mellyshum123 | last post by:
I need to read in a comma separated file, and for this I was going to use fgets. I was reading about it at http://www.cplusplus.com/ref/ and I noticed that the document said: "Reads characters...
1
by: =?Utf-8?B?UmF5IE1pdGNoZWxs?= | last post by:
Short of writing a custom version of the ListView control, is there a way to force the column headers to contain multiple lines. The problem is that the actual values of the items in each column...
7
by: =?Utf-8?B?TG9zdEluTUQ=?= | last post by:
Hi All :) I'm converting VB6 using True DBGrid Pro 8.0 to VB2005 using DataGridView. True DBGrid has a MultipleLines property that controls whether individual records span multiple lines. Is...
23
by: andrew | last post by:
Hi, I have been taken to task about the length of lines in the source html of: http://www.slrn.sourceforge.org which, as I commonly do, has no line breaks at all in the source html. My...
4
by: nxstar | last post by:
Hi I am confused about how to go about writing this program in perl. I have a text file with data in columns 8 and 9. I need to extract the data value from column 8 from the line being read and...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.