Results 1 to 4 of 4

Thread: Creating a SELECT (or maybe MINUS statment)

  1. #1
    Join Date
    Jul 2008
    Posts
    10

    Creating a SELECT (or maybe MINUS statment)

    Hello,

    I am trying to create a statement that will return plot numbers that don't exist in every five year period:

    1965
    1970
    1975
    1980.. etc until 2005

    some of the plots don't exist anymore because they were clearcut or for some reason were not measured for that cycle. I read that a MINUS statement will allow me to see what rows in one table are not present in another, I'm just not sure how to construct it property to get what I am looking for. I have tried:
    Code:
    select plotnum from density
    minus
    select sampyear from density
    ;
    I'll admit that I am still learning SQL but I am pretty sure this statement does not give me what I want. I tried something else like:
    Code:
    select plotnum from density
    where plotnum <> plotnum
    where sampyear in (1965,1970,1975,1980) */ etc...
    ;
    If there are other resources to help me learn that anyone could refer me to that would be great as well. Thanks in advance,

    Ladygray

  2. #2
    Join Date
    Jul 2008
    Location
    Belgium
    Posts
    17
    Hello


    Will this help you?

    select plotnum from density
    except
    select plotnum from density
    where sampyear in (1965,1970,1975,1980,1985,1990,1995,2000,2005)


    Greetings
    ld_be

  3. #3
    Join Date
    Jul 2008
    Location
    Belgium
    Posts
    17
    You can except chance in minus.

  4. #4
    Join Date
    Jul 2008
    Posts
    10

    Excellent, thanks!

    Thank you very much... too bad there are so many plot numbers that weren't remeasured each cycle!! Over 2000!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •