469,954 Members | 1,795 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,954 developers. It's quick & easy.

using sql to update a table

**** Post for FREE via your newsreader at post.usenet.com ****

Hello,

I am using sql+ to try and update a table and am having some trouble.

Below is a select statement with the result I want to acheive. I want to
get this result by using update to update my table. I have attempted to
create the update sql statement, see below.

I guess my major problem is concatenating results from the same table into
an update.

I'm new at sql and am wondering if this best be done using plsql?

Any suggestions would be great!

Thanks Julie

________________________select statement ______________________
select a.part_no, a.mat_sfty_data_sht_no || '_' ||b.mat_sfty_data_sht_no as
RESULTS
FROM part_seg_jp a,
part_seg_jp b
where a.part_no = b.part_no
and soundex(a.mat_sfty_data_sht_no) = soundex('K%')
and a.seg_no = 16
and soundex(b.mat_sfty_data_sht_no) != soundex('K%')
and b.seg_no = 11

______________________This is what the sql result is____________________

Part_NO Results

28 K2_SXW
47 K2_SXW
71 K2_SXW

_____________________The update statement________________________

update part_seg_jp b
set b.mat_sfty_data_sht_no = mat_sfty_data_sht_no || '_' ||
b.mat_sfty_data_sht_no
where mat_sfty_data_sht_no in (select a.mat_sfty_data_sht_no
FROM part_seg_jp a
WHERE soundex(a.mat_sfty_data_sht_no) = soundex('K%')
and a.seg_no = '16'
and a.mat_sfty_data_sht_no != 'NULL')
and b.mat_sfty_data_sht_no not like '%K%'
and b.seg_no = '11'

______________________The update result_____________________

0 rows updated.



-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
*** Usenet.com - The #1 Usenet Newsgroup Service on The Planet! ***
http://www.usenet.com
Unlimited Download - 19 Seperate Servers - 90,000 groups - Uncensored
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Jul 19 '05 #1
0 2703

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Robert Fitzpatrick | last post: by
4 posts views Thread by fmatamoros | last post: by
7 posts views Thread by Serge Rielau | last post: by
6 posts views Thread by insirawali | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.