Results 1 to 2 of 2
  1. #1
    Join Date
    May 2012
    Posts
    1

    Unanswered: Query: multiple tables, unique columns, join

    Hi!
    This is my first post so I thank you all first for helping out.

    I have many tables (~10), each with some unique, and some shared column headers.

    i.e.
    Table 1:
    Year, Month, Day, Hour, A, B, C, D, E

    Table 2:
    Year, Month, Day, Hour, A, B, C, D, E, F, G

    Table 3:
    Year, Month, Day, Hour, A, B, C, D, E, F, G, H, I

    I would like to create a query to have a table that shows:
    Year, Month, Day, Hour, A, B, C, D, E, F, G, H, I
    Ordered by Year, Month, Day, Hour

    Where the rows for each column (A-I) will have a null or 0 value if it is not present in the earlier tables.
    i.e. if Table 1 data started in 2012, and Table 3 data started in 2015, column H for example, would list 0's in the 2012 rows.

    I'm thinking I may need to use a Join, and not a Union, but I'm a newb at this so any help is much appreciated.

    Hope this makes sense, and I hope someone can help me out.

    Thanks!
    Last edited by cager; 05-28-12 at 22:43.

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    can you expand on the table design?
    the reason Im asking is I wonder if this is a symptom of table design rather than a query problem
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

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