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

Home -> Community -> Usenet -> c.d.o.server -> Help with a SELECT statement to return MAX record!

Help with a SELECT statement to return MAX record!

From: Adrian Harrison <adrianh_at_globalnet.co.uk>
Date: Fri, 02 Apr 1999 09:06:33 GMT
Message-ID: <37058743.149349833@news.globalnet.co.uk>


I have a varchar2 field called farm_code with data held in the form "xxxx9999".

For a group of records that have the same "XXXX" part I need a SELECT statement that returns the highest row based on the "9999" value.

I have a statement that seems to work fine but would like to know if this is the best/quickest way of achieving this -

select max(substr(farm_code,5,4))max_num from nvz_farms where substr(farm_code,1,4) = 'BRID';

Any thoughts?

Thanks in advance!

Adrian Harrison Received on Fri Apr 02 1999 - 03:06:33 CST

Original text of this message

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