Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: QUERY help.. not sure how to do this

Re: QUERY help.. not sure how to do this

From: Ryan S <rshevchi_at_vt.edu>
Date: 1 Aug 2005 12:41:02 -0700
Message-ID: <1122925262.773063.254390@g49g2000cwa.googlegroups.com>

Kevin Blount wrote:
> I need some help creating a QUERY..
>
> here's an example of what I need to do: say for instance my database
> contains 3 values:
>
> 4012345
> 3012345
> 4055555
>
> I want to create a query that will count the number of records where
> the last 5 are unique. In the example that count would equal 2
>
> How would I go about this? My first though would be to use DISTINCT,
> but I don't know how to format the SELECT DISINCT part of the query..
> is there some kind of RIGHT(field,5) method I can use?
>
> any help would be appreciated.

Select distinct substr(x, -5) from table. The negative means to count from right to left. Received on Mon Aug 01 2005 - 14:41:02 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US