Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2007
    Posts
    97

    Unanswered: Problem joining 2 Views

    Hi guys,

    I detected a strange behaviour when doing an inner join of two views.

    There is table_Objects, table_Contracts and view_Objects, View_Contracts.

    Table_Objects: ID, Price
    View_Objects: Select * from Table_Objects Where Price > 10

    Table_Contracts: ID, Year
    View_Contracts: Select c.ID, c.Year
    From Table_Contracts c Join View_Objects o on c.id=o.id

    Quiete simple so far, but it doesn't work. Imagine Object with id 3 that is shown in View_Objects and Table_Contracts but not shown in View_Contracts. How is that possible?

    EDIT: Sometimes its shown, sometimes not
    Thx for your reply!
    Last edited by silas; 05-10-07 at 08:40.

  2. #2
    Join Date
    Dec 2006
    Posts
    30
    Is Table_Contracts.ID a primary key or a foreign key to Table_Objects?

  3. #3
    Join Date
    Mar 2007
    Posts
    97
    Table_Contract's PK is (ID,Year)
    Table_Object's PK is (ID)
    There is a FK from Table_Contract(ID) to Table_Objects(ID)

  4. #4
    Join Date
    Mar 2007
    Posts
    97
    Oh, just realized that I'm joining a view and a table and not 2 views.

Posting Permissions

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