![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
HI, I want to know if is possible to update Table1.Col5 from an Table2.Col3 ?? The Problem is Col1 and Col2 doesn't have a same size. Exemple of record. Table 1 Col1 Col2 Col3 Col4 Col5 10 4001 F1 1 NULL 10 4001 F1 1 NULL 10 4003 F5 3 NULL Table 2 Col1 Col2 Col3 10 4001 S 10 4001 P 10 5009 S 24 4001 P I tried to update T1.Col5 with T2.Col3 by i got this result I used INNER join Table1 and Table2 on Col1 and Col2. Table 1 Col1 Col2 Col3 Col4 Col5 10 4001 F1 1 S 10 4001 F1 1 S 10 4003 F5 3 NULL Can you help me please. Thanks in advance. |
#3
| |||
| |||
|
|
"SAM" <sab... (AT) hotmail (DOT) com> wrote in message news:5f09267d-5086-4b7e-b945-63dd587167f6 (AT) i29g2000prf (DOT) googlegroups.com... HI, I want to know if is possible to update *Table1.Col5 from an Table2.Col3 ?? The Problem is Col1 and Col2 doesn't have a same size. Exemple of record. Table 1 Col1 Col2 *Col3 Col4 Col5 10 * *4001 *F1 * *1 * *NULL 10 * *4001 *F1 * *1 * *NULL 10 * *4003 *F5 * *3 * *NULL Table 2 Col1 Col2 Col3 10 * 4001 * S 10 * 4001 * P 10 * 5009 * S 24 * 4001 * P I tried to update T1.Col5 with T2.Col3 by i got this result I used INNER join Table1 and Table2 on Col1 and Col2. Table 1 Col1 Col2 *Col3 Col4 Col5 10 * *4001 *F1 * *1 * *S 10 * *4001 *F1 * *1 * *S 10 * *4003 *F5 * *3 * *NULL Can you help me please. Thanks in advance. I don't understand what end result you want. Please could you post your required results together with some explanation. I'd guess: UPDATE table1 SET col5 = *(SELECT col3 * FROM table2 * WHERE table2.col1 = table1.col1 * *AND table2.col2 = table2.col2); -- David Portas- Hide quoted text - - Show quoted text - |
|
Col1 Col2 Col3 Col4 Col5 10 4001 F1 1 S 10 4001 F1 1 S 10 4003 F5 3 NULL |
#4
| |||
| |||
|
|
HI, I got this result Table 1 Col1 Col2 Col3 Col4 Col5 10 4001 F1 1 S 10 4001 F1 1 S 10 4003 F5 3 NULL but my required results is Table 1 Col1 Col2 Col3 Col4 Col5 10 4001 F1 1 S 10 4001 F1 1 P<-------- 10 4003 F5 3 NULL i want a 'P' en the second record not a 'S' |
#5
| |||
| |||
|
|
i want a 'P' en the second record not a 'S' |
#6
| |||
| |||
|
|
"SAM" <sab... (AT) hotmail (DOT) com> wrote in message news:4ac7cb13-9b8a-46a3-be44-96c2ea23b8d0 (AT) i29g2000prf (DOT) googlegroups.com... i want a 'P' en the second record not a 'S' Please explain how you arrive at that result. Also, what are the keys of the two tables? Every table should have a key but Table1 has none that I can see. As Erland says, the easiest way to describe your problem is to post a CREATE TABLE (with keys please) and some INSERTs. -- David Portas |
#7
| |||||
| |||||
|
|
Hi, there is more explanation: I know is too long, but i post-it because i have a hard time with this probleme. |
|
-------------------------- Create Table Report ( |
|
What I want to do is to update my Report Table with TableQuantF |
|
Query : -------------- Insert Into tblTemp Select Province , Asset, QuantF From TableQuantF Where CODE = 'F1' |
|
Update TableQuantF Set TableQuantF.QuantF1 = tblTemp.QuantF Where TableQuantF.Province = tblTemp.Province And TableQuantF.Asset= tblTemp.Asset |
![]() |
| Thread Tools | |
| Display Modes | |
| |