Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Unique key

Unique key

Scheduled Pinned Locked Moved Database
tutorialquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    topcatalpha
    wrote on last edited by
    #1

    hi, I have a table with persons having a integer as a unique key. now i've made a second table groups defined by the persons in it. the combination of the uniek keys of the persons should be my unique key in the groups table. for example 1. person a 2. person b 3. person c first group is 1,2 second group is 1,3 third group is 2,3 fourth group is 1,2,3 Does anyone has any idea how i can store this data easely as unique key and still find the related data in an easy way ? Data delivered to search a group are the combinations of the persons. greetz and thx Kurt

    P N 2 Replies Last reply
    0
    • T topcatalpha

      hi, I have a table with persons having a integer as a unique key. now i've made a second table groups defined by the persons in it. the combination of the uniek keys of the persons should be my unique key in the groups table. for example 1. person a 2. person b 3. person c first group is 1,2 second group is 1,3 third group is 2,3 fourth group is 1,2,3 Does anyone has any idea how i can store this data easely as unique key and still find the related data in an easy way ? Data delivered to search a group are the combinations of the persons. greetz and thx Kurt

      P Offline
      P Offline
      PIEBALDconsult
      wrote on last edited by
      #2

      I'm not sure I follow you, but shouldn't you have a table of Groups

      1. Group1
      2. Group2
      3. Group3

      Then a table to represent the many-to-many relationships

      Person Group
      1 1
      1 2
      1 4
      2 1
      2 3
      2 4
      3 2
      3 3
      3 4

      T 1 Reply Last reply
      0
      • P PIEBALDconsult

        I'm not sure I follow you, but shouldn't you have a table of Groups

        1. Group1
        2. Group2
        3. Group3

        Then a table to represent the many-to-many relationships

        Person Group
        1 1
        1 2
        1 4
        2 1
        2 3
        2 4
        3 2
        3 3
        3 4

        T Offline
        T Offline
        topcatalpha
        wrote on last edited by
        #3

        thx for the response, but i'm not quite sure. if i deliver you person 2 and 3 can you give me the group the present ? i gues i need a select where group is the same for person 2 and 3 and where group is not used by other persons or so.. hmm this might work... Problem is that i get a bunch of persons and update common data as group, i'll need to check if the group exists if not i'll add the common data else i'll update the common data of those persons. so i didn't think about a cross table.. good thinking... thx just thinking now that i need to insert multiple keys in de many-to-many table when adding one record for a group, but that should not be a problem.

        1 Reply Last reply
        0
        • T topcatalpha

          hi, I have a table with persons having a integer as a unique key. now i've made a second table groups defined by the persons in it. the combination of the uniek keys of the persons should be my unique key in the groups table. for example 1. person a 2. person b 3. person c first group is 1,2 second group is 1,3 third group is 2,3 fourth group is 1,2,3 Does anyone has any idea how i can store this data easely as unique key and still find the related data in an easy way ? Data delivered to search a group are the combinations of the persons. greetz and thx Kurt

          N Offline
          N Offline
          nelsonpaixao
          wrote on last edited by
          #4

          listen, i don´t understand what you want to do. what about the groups stuff? name then to understand, maybe anyone could help you. do you have 5 tables? persons,group1?,group2?,group3?,group4? :omg:

          nelsonpaixao@yahoo.com.br trying to help & get help

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups