Results 1 to 3 of 3

Thread: Filtering for Numbers without Zeros

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jul 2004
    Posts
    30

    Filtering for Numbers without Zeros

    I have a query in access that is pulling a rating number from a table. I want to pick the most recent number in the query without a zero in it. It's also by dates. Dates and Rating are two seperate columns.
    Some examples.

    Date | Rating
    10/01/2007 | 0010/0
    6/13/2005 | 1002/0
    4/23/2003 | 2312/2 <- I only want numbers without zeros appearing

    If that isn't possible, how can I filter out the last number that is a zero.
    So if its /1, /2, /3 etc it finds it but doesn't if it is /0.

    Any help would be great. Sorry if it might be confusing to understand.

    Thanks,
    -Chris

  2. #2
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: Filtering for Numbers without Zeros

    To get the most recent, sort the records in descending order and use the Top clause. Use Like to check if the Rating contains a 0
    Code:
    SELECT Top 1 [Date], Rating
    FROM Ratings
    Where Rating Not Like '*0*'
    Order By [Date] Desc;
    Last edited by brucevde; Oct 2nd, 2007 at 05:45 PM.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jul 2004
    Posts
    30

    Re: Filtering for Numbers without Zeros

    Thank you for your post brucevde,

    Although it does work for the most part, it unfortunately didn't do what I needed it too. So instead I have written a routine to do the filtering, which came out quite nicely, just more work involved then I wanted.

    Thanks again for your reply.
    ~Chris

Posting Permissions

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



Click Here to Expand Forum to Full Width