locked
SQL primary key RRS feed

  • Question

  • HI,

    I have monthly tables (m1a_201101, m1a_201102 and M2b_201101, M2b_201102)

    M1a is a list of monthly customers info (it has yyyymm, custID...)

    m2b is monthly customer order transactions (it has custID linked with M1a table)

     

    If I combine the 2 month into one table m2b. How do i identify the month in m2b combined table?

     

    Thanks,

    Friday, November 11, 2011 3:54 PM

Answers

  • Since you are storing Monthly Information in M1a table and it should be aviable in your new combined table in format 'yyyymm'. So you use this to indentify month from this field.

    Please let me know if this doesn’t work for you. Hope I have answered you correctly.

    Thanks,
    Hasham

    • Marked as answer by Stephanie Lv Thursday, November 17, 2011 8:02 AM
    Friday, November 11, 2011 4:31 PM
    Answerer
  • After the TABLEs are joined, the PRIMARY KEY is a composite of yyyymm and CustId. Therefore, yyyymm will need to be ADDed to the combined m2b TABLE.

    • Proposed as answer by Hasham NiazEditor Friday, November 11, 2011 10:40 PM
    • Marked as answer by Stephanie Lv Thursday, November 17, 2011 8:02 AM
    Friday, November 11, 2011 5:09 PM
    Answerer

All replies

  • Since you are storing Monthly Information in M1a table and it should be aviable in your new combined table in format 'yyyymm'. So you use this to indentify month from this field.

    Please let me know if this doesn’t work for you. Hope I have answered you correctly.

    Thanks,
    Hasham

    • Marked as answer by Stephanie Lv Thursday, November 17, 2011 8:02 AM
    Friday, November 11, 2011 4:31 PM
    Answerer
  • After the TABLEs are joined, the PRIMARY KEY is a composite of yyyymm and CustId. Therefore, yyyymm will need to be ADDed to the combined m2b TABLE.

    • Proposed as answer by Hasham NiazEditor Friday, November 11, 2011 10:40 PM
    • Marked as answer by Stephanie Lv Thursday, November 17, 2011 8:02 AM
    Friday, November 11, 2011 5:09 PM
    Answerer