3 Replies Latest reply on Dec 21, 2012 6:15 AM by Alex Kerin

    Appending tables - union all with 3 tables

    Fred Arve Fahre

      Hi!

       

      I have an excel spreadsheet with 3 different sheets. Columns are the same, but content are different (a clientID would be found in one of the sheets only.) The amount of data makes me unable to append them in excel. Using the union tip in the FAQ section, i manage to append two tables, like this:

       

      SELECT [Bankkunder$].[BANK] AS [BANK],
         [Bankkunder$].[KUNDENUMMER] AS [KUNDENUMMER],
        [Bankkunder$].[POSTNUMMER] AS [POSTNUMMER],
        [Bankkunder$].[POSTSTED] AS [POSTSTED],

       

       

      "Bankkunder" as [Type]

      FROM [Bankkunder$]


      UNION

       

      SELECT
      [TABLEB$].[BANK] AS [BANK],
        [TABLEB$].[KUNDENUMMER] AS [KUNDENUMMER],
        [TABLEB$].[POSTNUMMER] AS [POSTNUMMER],
        [TABLEB$].[POSTSTED] AS [POSTSTED],
      "TABLEB" as [Type]

      FROM [TABLEB$]

       

      And this seem to work nicely. But how do i get my third table added? I tried to add another union, similar to the ones above, but didnt seem to work. And SQL is not really something i know.

       

      Any help would be appreciated :-)

       

      Fred