On Monday, January 09, 2012 8:12:18 am Tony Capobianco wrote: > tablename > -------------------- > tmp_staging0109 > tmp_staging1229 > tmp_staging0108 > > How can I write this correctly?
Had another idea. If you are looking for the highest numbered table below a certain number then maybe this: test(5432)aklaver=>\d name_test Table "public.name_test" Column | Type | Modifiers --------+-------------------+----------- fld_1 | character varying | test(5432)aklaver=>SELECT * from name_test ; fld_1 ----------------- tmp_staging0109 tmp_staging0108 tmp_staging1229 (3 rows) test(5432)aklaver=>select fld_1 from name_test where fld_1 like 'tmp_staging%' and fld_1< 'tmp_staging1230' order by fld_1 desc limit 1; fld_1 ----------------- tmp_staging1229 > > Thanks. > Tony -- Adrian Klaver adrian.kla...@gmail.com -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql