Results 1 to 3 of 3

Thread: php small query help

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2005
    Posts
    1,364

    php small query help

    PHP Code:
    $query "SELECT * FROM `Student`"
    Thats fine, but i need to extend it.

    The Students table has a field called 'Student_ID'
    The Persons table has a field called 'Student_ID' (foreign key etc)

    I want to select all the entries from the 'Student' table where the 'Student_ID' is not in the 'Persons' table

    any help guys?

  2. #2
    Frenzied Member mar_zim's Avatar
    Join Date
    Feb 2004
    Location
    Toledo Cebu City.
    Posts
    1,416

    Re: php small query help

    What db are you using? If mysql then you should search about joins I think there is equivalent about inner join in mssql to mysql.

    in mssql.
    $query = 'select * from student s inner join persons p where s.student_id=p.student_id';

  3. #3
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: php small query help

    That should also work in MySQL.

Posting Permissions

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



Click Here to Expand Forum to Full Width