Re: compare table names

From: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Cc: Tony Capobianco <tcapobianco(at)prospectiv(dot)com>
Subject: Re: compare table names
Date: 2012-01-09 16:33:23
Message-ID: 201201090833.24042.adrian.klaver@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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(dot)klaver(at)gmail(dot)com

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Greg Sabino Mullane 2012-01-09 16:51:30 Re: compare table names
Previous Message Tony Capobianco 2012-01-09 16:28:43 Re: compare table names