Date: 12/07/04 (MySQL Communtiy) Keywords: no keywords i recently wrote a gift wish list for a friend, but i'm stuck on a odd situation. "users" uid user "lists" lid uid title "things" tid lid title. things belong to lists, lists belong to users. simple. users are free to create and destroy their own lists. (duh) and then add/delete things onto said lists. in the begining, when a user deleted a list, i just deleted the list from the list table. (i wrote the list add/delete before i wrote the things stuff) this left "things" tied to lists that didnt exist anymore. i fixed this later by also deleting any "things" that had that listid. but i still have a table full of orphans. basicly what i'm looking for: SELECT things.tid FROM things, lists WHERE things.lid doesnt exist in lists.lid Source: http://www.livejournal.com/community/mysql/43652.html
|