Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2004
    Location
    Germany Düsseldorf
    Posts
    17

    Unanswered: Handle 1:n relations

    Hi,

    I build a local cube from a relation database. In the database there are 1:n relations.
    Is there a way to handle 1:n relations?
    For example:
    I have a table LOGGEDFLAW and a table LOGGEDREASON with a 1:n relation between them. We create a select statement of these tables and as an result we get duplicate records of LOGGEDFLAW each time more than 1 record of LOGGEDREASON are associated to 1 record of LOGGEDFLAW - this is the standard result I get with an relational JOIN operation. Now I want to count the LOGGEDFLAWs without the duplicates generated by the 1:n relationship.

    Best regards,
    Thorsten

  2. #2
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Code:
    USE Northwind
    GO
    
    CREATE VIEW myView99
    AS
    	SELECT o.OrderId, od.Quantity
    	  FROM Orders o INNER JOIN [Order Details] od
    	    ON o.OrderId = od.OrderId
    GO
    
    SELECT COUNT(DISTINCT OrderId), COUNT(*)
      FROM myView99
    GO
    
    DROP VIEW myView99
    GO
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  3. #3
    Join Date
    Mar 2004
    Location
    Germany Düsseldorf
    Posts
    17
    Oh sorry, I create a local cube. I need a way to create distict measures.

Posting Permissions

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