List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:January 5 2000 3:52pm
Subject:Re: is it possible to select the newest 100 rows
View as plain text  
>Hi!
>
>I have a table which is updated almost every day. There is a Field 
>with a date - but it's varchar.
>Now I want to get the newest 100 rows.
>
>Can someone show me the way how to do this?


If you've entered the values in a consistent format, then they should
sort in date order.  You can use ORDER BY col_name DESC on that column
and LIMIT 100 to pick the first 100 rows of the result.

If you've entered values inconsistently, this won't work.  For example,
if you use 1999-12-1 sometimes and 1999-12-01 sometimes, you're out of
luck.  Why don't you use a DATE column instead of a VARCHAR, by the way?

-- 
Paul DuBois, paul@stripped
Thread
is it possible to select the newest 100 rowsGregor Welters5 Jan
  • Re: is it possible to select the newest 100 rowsPaul DuBois5 Jan
    • Re: is it possible to select the newest 100 rowsGregor Welters5 Jan
      • Re: is it possible to select the newest 100 rowsPaul DuBois6 Jan
      • Re: is it possible to select the newest 100 rowshypnos6 Jan
  • Re: is it possible to select the newest 100 rowsEd Carp6 Jan