1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Database design help

Discussion in 'HTML, Graphics & Programming' started by hargi, 14 Oct 2009.

  1. hargi

    Wise Guy

    Joined: 19 Jul 2006

    Posts: 1,852

    Trying to develope a solution. we need some way of recording what we are doing and what impact it is having.
    I have a few tables.

    Users:
    user id
    user name

    Imput:
    imput id
    user id
    company id
    date
    time
    action

    Company:
    company id
    company name

    Target:
    Target id
    Task

    Now i think im a tabel short.
    The users table is a 1 to many with the imput table. The imput table is many to 1 to the company. What i dont know is how to join the company table to the Target table as one company has many targets and the targets can be used for more than one company.

    So for example company A may need to meet targets 1,2,3. Where as company B needs to meet target 2,3. I dont understand what fields i need in the tables to do this.
    Basically its a way to record user name, date, time, company , action and targets in a searchable format.

    TIA
     
  2. Dj_Jestar

    Caporegime

    Joined: 18 Oct 2002

    Posts: 28,997

    Location: Back in East London

    Many-to-many, via a link table.

    Companies:
    id
    etc

    Targets:
    id
    etc

    CompaniesTargets:
    companyId
    targetId