Sql for deleting with join

The code below produces the quote below.

$sql="SELECT id, geo, name FROM geo";
$sql=mysqli_query($databaseConnect, $sql);
while ( $rows =  mysqli_fetch_assoc($sql) )  {
echo '(' .$rows['id']. ') ' .$rows['geo'].' (' .$rows['name']. ')[br]';
}

And the code above produces the quote below.

$sql="SELECT mom, son FROM geoGroup ORDER BY mom, son";
$sql=mysqli_query($databaseConnect, $sql);
while ( $rows =  mysqli_fetch_assoc($sql) )  {
echo '(' .$rows['mom']. ') ' .$rows['son'].'[br]';
}

And the code below produces the quote below

$sql="SELECT mom, son, geo FROM geoGroup, geo 
WHERE mom=id AND name='Jane'
ORDER BY mom, son";
$sql=mysqli_query($databaseConnect, $sql);

I like to delete the result above from geoGroup.
The following is one of trials, but it seems not to work.

$sql="DELETE FROM geoGroup, geo 
WHERE mom=id AND name='Jane'";
$sql=mysqli_query($databaseConnect, $sql);

Can I make the deleting code above to work with your help?

instead of

DELETE FROM geoGroup, geo 
WHERE mom=id AND name='Jane'

try this

DELETE geoGroup
  FROM geoGroup, geo 
WHERE mom=id AND name='Jane'

by the way, the syntax for a multi-table delete is here – https://dev.mysql.com/doc/refman/5.7/en/delete.html

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.