Reputation: 39
I want to delete a row from a table of MySQL database
DELETE FROM students WHERE tutor_availability = student_availability;
tutor_availabilty
is contained within another table called tutors
. Possibly worth noting that I am using xampp. Wondering if anyone could help me with this?
Upvotes: 1
Views: 470
Reputation: 486
Depending on what it is you are actually trying to delete and how your records are related you may want to use and IN instead of a JOIN. This may also be a little easier to visualize.
For example:
DELETE FROM students where student_availability
IN (Select tutor_availability FROM tutors)
Here is a good explanation of JOIN vs IN:
Upvotes: 2
Reputation: 169
Didn't get the full picture here, but after reading like 10 times i think you have the following structure
So, you may want to try this:
"DELETE FROM students WHERE students.student_availability = tutors.tutor_availability INNER JOIN tutors ON (students.tutor_id = tutors.id)"
Upvotes: 0