Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 SQL Server 6.5 \ SQL Server 7.0
 Update Table

Author  Topic 

siktui82
Starting Member

8 Posts

Posted - 2007-06-27 : 21:43:41
Hi,

How do i update a table from a query search?

Example

TABLE 1
INVNO XONO
INV00001 XO0002
INV00001 XO0003
INV00003 XO0005
INV00006 XO0007

TABLE 2
INVNO PAYTYPE CHECKNO
INV00001 C NULL
INV00001 M DP00001
INV00001 H SP00001
INV00002 G NETS
INV00003 C NULL
INV00004 M DP00002
INV00004 H SP00002
INV00005 V VOU001

TABLE 3
INVNO RECSEQ XONO PAYTYPE CHECKNO
INV00001 01
INV00001 02

How do i update the table 3 from table 1 n table 2?

i tried to do but i got error
'Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
The statement has been terminated.'

Please help

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2007-06-27 : 22:06:48
for each of those 'INV00001' values you have multiple records in each of the other 2 tables. Do you want to insert multiple records into table3?

Dinakar Nethi
************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page

siktui82
Starting Member

8 Posts

Posted - 2007-06-27 : 22:32:37
If possible try not to enter multiples entries. But i just seem cant get it right.

Thanks
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-06-28 : 09:19:02
<<
i tried to do but i got error
>>

Post the query you used

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -