Results 1 to 6 of 6

Thread: Return Specific Records NOT Matching Input Year

Threaded View

  1. #1
    Join Date
    Dec 2009
    Posts
    79

    Thumbs up [RESOLVED] Return Specific Records NOT Matching Input Year

    I have a field in my table which contains a date. Example: 06/30/2010, 09/30/2003, 03/31/2005, 06/30/2011, etc – this table also contains a field for company code.

    I need to get a list of all company codes that do not have an entry for an input year; example: 2010

    I can do:
    Code:
    select companycode, orderyear 
    from mytable 
    where year(orderyear) <> ‘2010’
    And it will give me a list of ALL records in the table that do not contain a date for 2010, but what I need are JUST the records that do not contain an entry for 2010.

    For example, I do not want to see every record in the table for companycode 12345 that doesn't have an orderyear date in 2010. I just want to see the one record for companycode 12345 where the orderyear field is blank or NULL.

    How would I refine that query to return such a result?
    Last edited by Moe1950; 08-11-2010 at 10:03 AM.

Posting Permissions

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