Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

My SQL problem.

Options
  • 17-07-2011 9:53am
    #1
    Closed Accounts Posts: 6,281 ✭✭✭


    Hello,

    Just a quick question:

    I've got two tables, galleryInfo and gallery, Gallery info contains a column 'eventID' there are several rows in the gallery table with the column 'event' that should be deleted when I run this query

    [PHP]DELETE
    FROM gallery
    WHERE event =(SELECT eventID FROM galleryInfo WHERE ID = 20 ) [/PHP]

    I've also tried:
    [PHP]DELETE
    FROM gallery
    WHERE event IN (SELECT eventID FROM galleryInfo WHERE ID = 20 ) [/PHP]

    The subquery will only ever return one row. Can anyone help?


Comments

  • Registered Users Posts: 49 Jethropool


    Are gallery.event and galleryinfo.eventID linked?


  • Closed Accounts Posts: 6,281 ✭✭✭Ricky91t


    Oh duh, just went to post two screen shots from PHP my admin showing how the data is linked. Turns out there were no images in the gallery for that event. *facepalm*

    Thanks Jethropool :)


Advertisement