Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2011
    Posts
    48

    Unanswered: Two tables, want to run query to join them

    Alright,

    I have two tables one having first year premiums, and the other renewal premiums.

    They both are sorted by bulkid which is common between them.

    I want to run a query so i can get all the information from each table in one, but I can't run a union query as the table with first year premiums has less rows because not ever bulkid has first year premiums. Is it possible to make a query so that for bulkid's that don't have first year premiums it just shows up as zero?

    thanks,

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    show us the table design
    but in theory its going tobe something like

    select my, column, list from mytable
    join myothertable on myothertable.thatcolumn = mytable.thiscolumn
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    You can perform a UNION operation on two SELECT queries, one of them having a constant.

    - Table1 has 6 columns: Col1, Col2, Col3, Col4, Col5, Col6
    - Table2 has 5 columns: Col1, Col2, Col3, Col4, Col6
    - Its possible to write a query such as:

    Code:
    SELECT Col1, Col2, Col3, Col4, Col5, Col6
      FROM Table1
    UNION
    SELECT Col1, Col2, Col3, Col4, 0, Col6
      FROM Table2
    Have a nice day!

Posting Permissions

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