field contains spaces : sql

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

cgjoker

Thread Starter
Joined
Aug 13, 2003
Messages
205
A field may have data such as 'This is a test'.

If I select this field within a unix for loop the result of this query is

This
is
a
test.

How can I get it so that the result stays on one line.

The unix code is below.

number=`db2 -x "select distinct(number) from test"`

for n in $number
do
echo "getting data for number"
data=`db2 -x "select data from test where number= $number"`
for d in $data
do
echo $d
done
done

result is

1 This
1 is
1 a
1 test

ideal results
1 This is a test
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Members online

Top