|
-
May 1st, 2006, 07:10 AM
#1
Thread Starter
Frenzied Member
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?
-
May 6th, 2006, 03:01 AM
#2
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';
-
May 6th, 2006, 03:08 AM
#3
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|