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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

two table

Status
Not open for further replies.

tseegii

Programmer
Dec 14, 2003
9
MN
Hello
How can I change table2?

Table1```` Table2````````````````````` Table2
--------- 1 a .... ..---------------1 a .... ..
1 a I-- 2 c .... ..----result-----2 c .... ..
2 c II-- 2 b .... ..---------------7 d .... ..
7 d II-- 7 d .... ..
--------- 2 d .... ..
 
tseegii,

Are you trying to get everything from table2 that is in table1? Do you want the results in a seperate table or are you trying to delete them from table2? What are the names of those fields you show above in your example (would be nice so we could give you a working example)?

jimoo,

It is not just you, I too am confused.

Slighthaze = NULL
[sub]craig1442@mchsi.com[/sub][sup]
"Whom computers would destroy, they must first drive mad." - Anon​
[/sup]
 
jimoo
F1, F2, F3, F4 field name
Table1```` Table2````````````````````` Table2
F1 F2 F3 F1 F2 F4 F1 F2 F4
1 k I 1 k .... ..---------------1 k .... ..
2 a I-- 2 a .... ..----result-----2 a .... ..
3 c II-- 2 b .... ..---------------3 c .... ..
7 d II-- 3 c .... .. 7 d
--------- 7 d .... ..
 
tseegii,

All I could understand is that in the result contains common records and field structure of the result is same as that of Table2.

If you don't want UNCOMMON records DELETE FROM table2. Otherwise SELECT FROM table2 WHERE records are COMMON INTO table3.

PURU
 
I have two tables, i'll compare field1 and field2 into table1 with field1 and field2 into table2. So, rows which are not exist table1 to be deleted from table2. /showing following example/

F1, F2, F3, F4 field name
Table1```` Table2````````````````````` Table2
F1 F2 F3 F1 F2 F4 F1 F2 F4
1 k I 1 k .... ..---------------1 k .... ..
2 a I-- 2 a .... ..----result-----2 a .... ..
3 c II-- 2 b .... ..---------------3 c .... ..
7 d II-- 3 c .... .. 7 d
--------- 7 d .... ..
how can i do? Please help me?
 
try something like this:

*select records from t2 which are not present in t1
SELECT TRANSFORM(f1,"99")+f2 FROM t2 ;
WHERE TRANSFORM(f1,"99")+f2 NOT in ( ;
SELECT TRANSFORM(f1,"99")+f2 FROM t1) ;
INTO CURSOR c1
*delete records from t2 which are in c1
DELETE FROM t2 WHERE TRANSFORM(f1,"99")+f2 ;
in (select * from c1)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top