|
-
Oct 2nd, 2007, 04:10 PM
#1
Thread Starter
Junior Member
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
-
Oct 2nd, 2007, 05:38 PM
#2
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.
-
Oct 9th, 2007, 01:11 PM
#3
Thread Starter
Junior Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|