-
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?
-
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';
-
Re: php small query help
That should also work in MySQL.