Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2012
    Posts
    24

    Unanswered: I want to append two tables

    Hi

    I have two tables that I want to join. The tables are very basic


    File name: Table 1.dbf
    -------------------------
    year colA colB
    -------------------------
    0 1 2
    1 1 4
    2 5 6


    File Name: Table 2.dbf
    -------------------------
    year colC colD
    -------------------------
    0 a b
    1 1 d
    2 e f


    I want the result to be


    File Name: Result.dbf
    -------------------------
    Result
    -------------------------
    1
    1
    5
    a
    1
    e

    I want the result to be saved as a new file. So far my code looks like

    Code:
    SELECT colA FROM Table 1.dbf;
    UNION ALL
    SELECT colCfrom Table 2.dbf;
    INTO TABLE Result.dbf
    The program don't recognize UNION ALL. I have followed the structure from different websites, but it don't want to work

  2. #2
    Join Date
    Nov 2002
    Posts
    128
    Provided Answers: 1
    Just like previously, there are a number of un-answered questions regarding your issue.
    Let's try to get those answers FIRST.

    One thing you have never told us is what version of Foxpro you are using.
    Hopefully it is not one of the OLD non-Visual versions. Those versions have a lesser support for SQL Queries.
    If you are not already doing so, I'd recommend that you should be using Visual Foxpro 9 VFP9).

    If you have an existing OLD FP application to maintain, OK
    But if you are developing something new or learning so that you can developing something new, use the latest version.

    Good Luck

  3. #3
    Join Date
    Nov 2012
    Posts
    24
    Hi
    I was able to solve it with a lot of trial and error. The code now looks like

    SELECT * from File1;
    union all;
    select * from uitkering;
    INTO TABLE aaatmp.tmp

    USE aaatmp.tmp
    SELECT jaar as Jaar,;
    overig as "P01";
    FROM aaatmp.tmp
    COPY TO aaa.dbf


    (PS I am usinf FP 9.0)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •