Re: Select Cast Error

From: mike <mike(at)thegodshalls(dot)com>
To: Brad Budge <bradbudge(at)hotmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Select Cast Error
Date: 2006-09-22 03:42:27
Message-ID: 1158896547.32431.7.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> select cast((max(substring(test.test from 6 for 4))) as integer) + 1
> FROM test where max(substring(test.test from 11 for 2));

This where clause is just returning a number but not comparing it to
anything. Normally it would be something like WHERE test.test =
max(substring(test.test from 11 for 2)). That is the reason for the
error message you are seeing.

I don't quite get how you are expecting to return 4 from 0004 instead of
3 from 0003 based on the statement above.

Mike
>
>
> 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. Windows Live Mail.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jim Nasby 2006-09-22 03:43:44 Re: Sun Java Studio Creator and PostgreSQL
Previous Message Jim Nasby 2006-09-22 03:41:13 Re: Majordomo drops multi-line Subject: