Welcome to Sign in | Help

extragere date din 2 tabele

  •  08-30-2011, 2:46 PM

    extragere date din 2 tabele

    Salut, sunt nou in sql si am nevoie de putin ajutor pentru situatia de mai jos:

    am urmatoarele 2 tabele:

    Sales Table

    BookName MonthSales LibrarySales BookStoreSales
    x 2010.11 5 1
    x 2010.12 2 3
    y 2010.10 1 2
    y 2010.11 3 2
    y 2010.12 4 1

    Plan Table

    BookName MonthPlan LibraryPlan BookStorePlan
    x 2010.12 10 3
    x 2011.01 10 3
    x 2011.02 5 3
    y 2010.11 5 3
    y 2010.12 5 3
    y 2011.01 5 3
    y 2011.02 5 3

    cum as putea construi un query care sa afiseze rezultatul in asa fel incat sa am 1 rand/BookName/Month, ca in exemplul de mai jos:

    BookName Month LibrarySales BookStoreSales LibraryPlan BookStorePlan
    x 2010.11 5 1 NULL NULL
    x 2010.12 2 3 10 3
    x 2011.01 NULL NULL 10 3
    x 2011.02 NULL NULL 5 3
    y 2010.10 1 2 NULL NULL
    y 2010.11 3 2 5 3
    y 2010.12 4 1 5 3
    y 2011.01 NULL NULL 5 3
    y 2011.02 NULL NULL 5 3

    Multumesc,

    Toate bune,
    adi
View Complete Thread
Powered by Community Server (Commercial Edition), by Telligent Systems