Jump to content


Photo

Help( many -many relationship)?


  • Please log in to reply
3 replies to this topic

#1 chihcc

chihcc
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 02 July 2005 - 05:12 PM

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!!

#2 redbullmarky

redbullmarky
  • Staff Alumni
  • Advanced Member
  • 2,863 posts
  • LocationBedfordshire, England

Posted 15 July 2005 - 03:34 PM

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!!

View Post


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
"you have to keep pissing in the wind to learn how to keep your shoes dry..."

I say old chap, that is rather amusing!

#3 obsidian

obsidian
  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 15 July 2005 - 04:47 PM

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!!

View Post


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.
You can't win, you can't lose, you can't break even... you can't even get out of the game.

<?php
while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx

#4 ecstasy

ecstasy
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 20 July 2005 - 06:02 PM

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!!

View Post

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!!

View Post


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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users