Help with the logic of a SQL script

  • Hi,
    I am just looking for some pseudo code/logic for a SQL script I am going to create.

    I have two tables that are related, one is called entry and the other is called item. One entry can have many items. The item entry has a foreign key that can link to the entry's primary key.

    In the item table there is a status code attribute which can be any number from 1 to 15.
    I want to create a script that will look for any entry where all the relating items are status 7.

    I hope this makes sense. Ithink I am going to kick myself when I work it out.
    Paul

  • Something like
    SELECT * FROM Entry WHERE EntryID NOT IN (SELECT EntryID FROM Items WHERE Status <> 7)

    Thomas Rushton
    blog: https://thelonedba.wordpress.com

  • Wrong topic.

    Thom~

    Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
    Larnu.uk

  • thank you ever much ThomasRushton!

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply