Select Cast Error

From: "Brad Budge" <bradbudge(at)hotmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Select Cast Error
Date: 2006-09-22 01:57:43
Message-ID: BAY102-W3109FEEE433A0617FA6D7AB210@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have a field that is varchar(15) type and an example of data I'm working with is (PROJ-0001-06)

I can make these two select statements work but not together.
select cast((max(substring(test.test from 6 for 4))) AS INTEGER) + 1 FROM test;select max(substring(test.test from 11 for 2)) FROM test;

I want this to work like this.
select cast((max(substring(test.test from 6 for 4))) as integer) + 1 FROM test where max(substring(test.test from 11 for 2));

List below is a better idea of what my table looks like and the result I need.
PROJ-0004-05
PROJ-0001-06
PROJ-0002-06
PROJ-0003-06

When I run my select statement I want to return the number 4. The idea is that I need the next highest number in the middle but take in consideration that the highest trailing numbers take president.

There error I get is this ERROR: argument of WHERE must be type boolean, not type text
_________________________________________________________________
Be one of the first to try Windows Live Mail.
http://ideas.live.com/programpage.aspx?versionId=5d21c51a-b161-4314-9b0e-4911fb2b2e6d

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Christopher Browne 2006-09-22 02:27:07 Re: postgresql rising
Previous Message Rajarshi Guha 2006-09-22 00:14:49 dumping 8M bit fields