By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,302 Members | 1,280 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,302 IT Pros & Developers. It's quick & easy.

using sql to update a table

P: n/a
**** Post for FREE via your newsreader at ****


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
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 || '_' ||
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.

*** - The #1 Usenet Newsgroup Service on The Planet! ***
Unlimited Download - 19 Seperate Servers - 90,000 groups - Uncensored
Jul 19 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.