Focal Point
MERGING ROWS

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/8691068331

June 15, 2005, 09:17 PM
MADDY
MERGING ROWS
Hello friends,
i wanted to whether we can merge rows from two different hold files.that is for example if we have 10 rows in hold1 and 25 rows in hold2 and both these hold files have the same fields then is it possible to club both the hold files and make a single file which should contain total 35 rows.
thanks for ur help
maddy
June 15, 2005, 10:15 PM
TexasStingray
There are several way to accomplish this one way I us is hold format FOCUS then use the USE command. example:

TABLE FILE CAR
PRINT CAR
BY COUNTRY
ON TABLE HOLD AS HOLD1 FORMAT FOCUS
END
TABLE FILE CAR
PRINT CAR
BY COUNTRY
ON TABLE HOLD AS HOLD2 FORMAT FOCUS
END

USE
HOLD1 AS HOLD1
HOLD2 AS HOLD1
END

TABLE FILE HOLD1
PRINT COUNTRY CAR
END

-* END EXAMPLE 1
another way is like this

TABLE FILE CAR
PRINT
CAR
BY COUNTRY
MORE
FILE CAR
PRINT
CAR
BY COUNTRY
ON TABLE HOLD AS HOLD1
END

TABLE FILE HOLD1
PRINT
COUNTRY
CAR
END

Hope this helps
June 15, 2005, 10:34 PM
k.lane
Once again, universal concatenation is perfect.

TABLE FILE CAR
PRINT CAR
BY COUNTRY
ON TABLE HOLD AS HOLD1 FORMAT FOCUS
END

TABLE FILE CAR
PRINT CAR
BY COUNTRY
ON TABLE HOLD AS HOLD2 FORMAT FOCUS
END

If both files are identical in layout you can do the following

TABLE FILE HOLD1
PRINT CAR
BY COUNTRY
ON TABLE HOLD AS MERGE
MORE
FILE HOLD2
END

MERGE contains all records.
Ken
June 16, 2005, 01:46 PM
codermonkey
Not to beat a dead horse but you can also create a filedef with an append( and use

HOLD AS HOLD1 FORMAT ALPHA for the first and SAVE AS HOLD1 FORMAT ALPHA for the second file...
June 17, 2005, 04:05 PM
MADDY
Thanks gut=ys its working now
June 17, 2005, 05:23 PM
Lloyd
and to be totally beligerent and to beat a dead horse,.....

my favorite way is an SQL UNION of the hold files. ie:

select blah from hold1
union
select blah from hold2