Database one is called widgets, it has "id" and "title". Database two is called widget-layouts and it has "module-id", "widget-id", "position", and "weight".
What I am trying to do is check to see if widgets.id exists in widget-layout.widget-id and if it does, then does widget-layouts.position = 0. I also want to get the values of widgets that don't exist in widget-layouts.
Here is the mysql query I have been working with.
SELECT * FROM widgets, widget-layouts WHERE (widge-layouts.position = '0' AND widgets.id = widget-layouts.widget-id) OR widgets.id NOT IN (SELECT * FROM widget-layouts)
With this query I am getting a huge list of widgets where each widget is displayed multiple times.
Any ideas about this?