Jump to content

Help( many -many relationship)?


Recommended Posts

  • 2 weeks later...
Hi, anyone can tell me how to solve the many -many relationship(database) problem using DW without using the extention from DW?

or can suggest any simple method on solving this problem ?

thanks u!!

248426[/snapback]

 

hi

 

can you give us a better idea of exactly what youre trying to do (ie what databases/tables) youre working with and i may be able to help

 

cheers

 

mark

Link to comment
Share on other sites

Hi, anyone can tell me how to solve the many -many relationship(database) problem using DW without using the extention from DW?

or can suggest any simple method on solving this problem ?

thanks u!!

248426[/snapback]

 

first off, welcome to the forums!

 

easiest way is to create a "joining" table. basically, just a table that holds the ids of the related items, so, if i have a class->student many-many relationship, i would have a classes table, a students table, and a roll table. the roll table would only store two pieces of data: class_id and student_id. that way, i can easily see either all the classes a student is in or all the students in a particular class.

Link to comment
Share on other sites

Hi, anyone can tell me how to solve the many -many relationship(database) problem using DW without using the extention from DW?

or can suggest any simple method on solving this problem ?

thanks u!!

248426[/snapback]

Hi, anyone can tell me how to solve the many -many relationship(database) problem using DW without using the extention from DW?

or can suggest any simple method on solving this problem ?

thanks u!!

248426[/snapback]

 

Supposing that you are having two entities:

Users: (UserId, UserName, UserPassword)

Products: (ProductId, ProductDescription)

 

Supposing that an user have more than one sales. You can store this information within an intermediate table:

UsersSales with the following structure (UserId, ProductId)

 

Your SQL will sound smth like that

SELECT * FROM users 
[INNER|LEFT|RIGHT] JOIN UsersSales
ON Users.UserId = UsersSales.UserId
[INNER|LEFT|RIGHT] JOIN Products 
ON UserSales.ProductId = Products.ProductId
WHERE UserId = x

 

You haven't been so specific about what are you going to do.

 

For more details about SQL JOIN you should visit: W3Schools website

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.