Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: QUERY help.. not sure how to do this
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
![]() |
![]() |