#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    7
    Rep Power
    0

    Display information from 3 tables using 2 unique id


    i have 3 tables and want to use one interface to display their related information from the tables.i have 1 unique id that relates the tables.pls i need a single sql code to do that
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    7
    Rep Power
    0

    How to use 1 id to display data from 3 tables using one interface


    i have 3 tables and want to use one interface to display their related information from the tables.i have 1 unique id that relates the tables.pls i need a single sql code to do that
  4. #3
  5. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,026
    Rep Power
    4210
    Code:
    SELECT frabilgimjer.gromulphastic
         , frabilgimjer.corbustackle 
         , quistipunctous.clapfrepple
         , haplistplogget.whipfintaggle
      FROM frabilgimjer
    INNER
      JOIN quistipunctous
        ON quistipunctous.scrimflabat = frabilgimjer.horbliston
    INNER
      JOIN haplistplogget
        ON haplistplogget.opsilfrummer = quistipunctous.scrimflabat
    exactly what you asked for
    r937.com | rudy.ca
    please visit Simply SQL and buy my book
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    7
    Rep Power
    0
    @r937
    what i mean is this i have

    t1
    *sn
    *regno
    *names
    *college
    *gender

    t2
    *sn
    *regno
    *names
    *college
    *gender


    t3
    *sn
    *regno
    *names
    *college
    *gender

    and

    t4
    *sn
    *hn
    *bn
    *bs

    t5
    *sn
    *hn
    *bn
    *bs

    t6
    *sn
    *hn
    *bn
    *bs

    i need php/mysql that
    if sn in t1 = sn in t4
    or if sn in t2 = sn in t5
    or if sn in t3 = sn in t6

    it should display their related information using a single mysql query and also one page interface to relate and output them

    note: i design the database schema like that with a purpose
  8. #5
  9. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,026
    Rep Power
    4210
    your first post says "i have 3 tables ... i have 1 unique id that relates the tables"

    your thread title says "Display information from 3 tables using 2 unique id"

    now there are 6 tables and 6 ids

    you're on your own, bro
    r937.com | rudy.ca
    please visit Simply SQL and buy my book
  10. #6
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    7
    Rep Power
    0
    bro,that's mistake on my side.
    its actually 3 tables relating to 3 tables using 1 id ie the sn. pls help me with a single mysql query that will relate them individually
  12. #7
  13. Mad Scientist
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Oct 2007
    Location
    North Yorkshire, UK
    Posts
    3,660
    Rep Power
    4123
    I said I didn't like ORM!!! <?php $this->model->update($this->request->resources[0])->set($this->request->getData())->getData('count'); ?>

    PDO vs mysql_* functions: Find a Migration Guide Here

    [ Xeneco - T'interweb Development ] - [ Are you a Help Vampire? ] - [ Read The manual! ] - [ W3 methods - GET, POST, etc ] - [ Web Design Hell ]
  14. #8
  15. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,026
    Rep Power
    4210
    Originally Posted by Northie
    Try: SQL INNER JOIN
    you mean like in post #3 here?
    r937.com | rudy.ca
    please visit Simply SQL and buy my book

IMN logo majestic logo threadwatch logo seochat tools logo