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

Merging the contents of Two tables into a temporary table

Status
Not open for further replies.

Wendz

Programmer
Aug 9, 2000
47
0
0
PH
Visit site
Hi Everyone!

I need to have records on two tables having similar structure with an employee code like "0001" and store it on a temporary table with the same structure.How am I gonna do it? Can I use query to pruduce the results?

Thanks
 
Hello

I didn't understood exactly the question, but if you have two tables with the same structure and you want to obtain a temporary table containing those two tables, you can use the JOIN clause:

SELECT * FROM <table1> UNION SELECT * FROM <table2> WHERE <condition> INTO CURSOR crCursor


Hope this helps Grigore Dolghin
Class Software
Bucharest, Romania
 
1.
SELECT * FROM myTable1 INTO DBF myTempTable ;
WHERE !DELETED() ;
UNION ALL SELECT * FROM myTable2 WHERE ! DELETED()

This will give you the result in the myTempTable storted in harddisk.

2.
SELECT * FROM myTable1 INTO CURSOR myTemp ;
WHERE !DELETED() ;
UNION ALL SELECT * FROM myTable2 WHERE ! DELETED()

This will give you the result in a CURSOR myTemp.




ramani :-9
(Subramanian.G)
FoxAcc
ramani_g@yahoo.com
LET KNOW IF THIS HELPED. ENOUGH EXPERTS ARE HERE TO HELP YOU OUT! BEST OF LUCK :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top