orphans

    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.

    i have 3 tables.

    "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

« My brain hurts... || MySQL support for AMD64 »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home