Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Groups of Groups?
> Rene Nyffenegger <rene.nyffenegger_at_gmx.ch> wrote in message news:<b1u8s7$166n38$1_at_ID-82536.news.dfncis.de>...
>> select id, start_date from ( >> select >> id, >> max(start_date) over() start_date, >> rank() over (order by length(prefix) desc, start_date desc) r >> from >> prefix_ >> where >> sysdate between start_date and end_date and >> substr('1234501234',1,length(prefix)) = prefix >> ) >> where r = 1;
This is because it was not clear to me what you wanted. I thought you need to have both: the id of the longest matching substring AND the LATEST start_date of any prefix matching the phonenumber.
Rene Nyffenegger
-- no sig todayReceived on Fri Feb 07 2003 - 13:46:23 CST
![]() |
![]() |