sql help!!
Results 1 to 2 of 2

Thread: sql help!!

  1. #1
    Join Date
    Nov 2010
    Posts
    1

    sql help!!

    Hi Guys!
    I have three tables with the following structure:
    TABLE: COVER
    POLICY COVER DEFFECDATE DNULLDATE GP_ID
    600001 1 30/03/2010 30/06/2010 6830
    600001 62 30/03/2010 30/06/2010 8175
    600001 1 30/06/2010 NULL 6872

    TABLE: PREMIUM
    POLICY EFFECDATE NRECEIPT SOFFICIALBILL PREMIUM
    600001 30/03/2010 1 IN100001 100
    600001 30/04/2010 2 IN100002 100
    600001 30/05/2010 3 IN100003 100
    600001 30/06/2010 4 IN100004 50
    600001 30/07/2010 5 IN100005 50

    TABLE: PREMIUM_DETAIL
    NRECEIPT NDETCODE PREMIUM
    1 1 75
    1 62 25
    2 1 75
    2 62 25
    3 1 75
    3 62 25
    4 1 50
    5 1 50

    I'd like to get the following resultset:
    POLICY COVER EFFECTDATE SOFFICIALBILL PREMIUM GP_ID
    600001 1 30/03/2010 IN100001 75 6830
    600001 62 30/03/2010 IN100001 25 8175
    600001 1 30/04/2010 IN100002 75 6830
    600001 62 30/04/2010 IN100002 25 8175
    600001 1 30/05/2010 IN100003 75 6830
    600001 62 30/05/2010 IN100003 25 8175
    600001 1 30/06/2010 IN100004 50 6872
    600001 1 30/07/2010 IN100005 50 6872

    Any help is much appreciated. Thanks.

  2. #2
    Join Date
    Aug 2012
    Posts
    1
    what are the fields that hold it all together? We will need something in one table that ties it to the next. All three tables can have different fields that tie them together. For instance, it looks like POLICY is the Premium table and Premium_Detail tables both have a field called POLICY. I look at the data and see that it holds the same information. However, Policy & EffecDate look like they may be unique (when queried together) and may be what you ned to link the 2 tables. The Premium_Detail either connects with the Premuim table using the NRECEIPT field?

Posting Permissions

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