title: How in SQLite can i delete a repeated database table rows that have the same name if these repeated rows are associated with rows in another table?
body: <p>I have a two tables. 1. restaurants, 2.menuItems. the menuItems rows are associated with the restaurants using their primary key as foreign keys. Now I have some restaurants with the same name and I want to remove them except one, also, I want to remove the associated items in  menuItems table. how can I do that using sqlite query? I tried this without any success, i got syntax error.</p>
  
  <pre><code>Delete  FROM restaurant inner join menu_item  on restaurant.id=menu_item.restaurant_id
  WHERE name NOT IN (SELECT min(name)
                      from restaurant
                      group by id)
  </code></pre>