SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict Caryn's Avatar
    Join Date
    Aug 2002
    Location
    Sydney, Australia
    Posts
    284
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Grouping Results from 2 tables

    Hi, I have 2 tables in MySQL. One has the following columns:
    job_id, job_title, description, ind_id , contact and the other has simply: ind_id and industry

    It's for a simple positions listing script that I'm writing for a client so they can update their own website.

    This is what I would like to do - For every industry, I would like to list the title of every job under that industry. For example:

    Health Care
    Nursing Unit Manager <= These would be links to the full job descriptions.
    Psychologist
    Xenobiologist

    Management
    Jnr. Manager

    Primary Industry
    Sugar Milling Plant Worker

    etc...

    Can anybody help me out with the proper way to script this?

    Thanks.

  2. #2
    SitePoint Addict Caryn's Avatar
    Join Date
    Aug 2002
    Location
    Sydney, Australia
    Posts
    284
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is anybody able to help?

    Need more information?

  3. #3
    .NET inside archigamer's Avatar
    Join Date
    Jan 2002
    Location
    Strongsville OH
    Posts
    1,534
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you will have to use a join

    Code:
    select j.job_id, j.job_title, j.description, j.contact from jobs j, industry i right join i on i.ind_id=j.ind_id where //insert where statement here
    Web Finesse Studios
    Professional, business oriented web hosting and development.

  4. #4
    SitePoint Addict Caryn's Avatar
    Join Date
    Aug 2002
    Location
    Sydney, Australia
    Posts
    284
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks archigamer!

    Does anybody have any suggestions about the PHP code I should use?

  5. #5
    SitePoint Addict Caryn's Avatar
    Join Date
    Aug 2002
    Location
    Sydney, Australia
    Posts
    284
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Could I use this instead of a RIGHT JOIN?
    PHP Code:
    "SELECT * FROM ncw_joblisting j LEFT JOIN ncw_industry i ON j.ind_id=i.ind_id WHERE j.ind_id='$ind_id'" 


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •