Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing Values Where Multiples Are Present 1

Status
Not open for further replies.

JezEling

IS-IT--Management
Mar 22, 2004
127
GB
Hi All,

Just a quick question, i'm trying to add a value to a table by checking another table to get the correct value. For example:-

Table 1

Part Number-Classification-Newly Inserted Value
1 A
1 A
2 B

Table 2

Part Number-Value To Insert
1 Value1
2 Value2

However when I run my query is tells me it cannot run as the sub query returned more than one result.

Does anyone have any suggestoins as to how I could work around this?

Thanks in advance

Jez
 
can i have ur query???

Known is handfull, Unknown is worldfull
 
Hi,

This is the query that I have written: -

Update PH_SalesHist
set abn=(select abn from phabn where phabn.partnum=ph_saleshist.PNUM20)

In relation to my example, ph_saleshist=table2 and phabn=table1 and abn is the value_to_be_inserted

Many Thanks

Jez
 
try:

Update PH_SalesHist
set abn=(select distinct abn from phabn where phabn.partnum=ph_saleshist.PNUM20)


Known is handfull, Unknown is worldfull
 
That seems to have got it, i'll do some propar testing and let you know for sure.

Thanks very much for your help

Jez
 
sure...

Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top