Path: csiph.com!feeder.erje.net!2.eu.feeder.erje.net!news2.arglkargh.de!news.albasani.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Robert Klemme Newsgroups: comp.lang.java.programmer Subject: Re: Where to put the return Date: Sat, 19 Aug 2017 15:35:06 +0200 Lines: 26 Message-ID: References: <87zib6zeup.fsf@munus.decebal.nl> <87y3qlnyvj.fsf@munus.decebal.nl> <87bmnbj09u.fsf@munus.decebal.nl> <877exzixum.fsf@munus.decebal.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net 8oPvsIkALzGXYyjZ/c6Phgo+tXlW4cfEKjjQEU3qHffS3ExEk= Cancel-Lock: sha1:oy+HZ1WVQFb0X9o9pm3RxEzZXgQ= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 In-Reply-To: <877exzixum.fsf@munus.decebal.nl> Content-Language: en-US Xref: csiph.com comp.lang.java.programmer:37284 On 19.08.2017 13:46, Cecil Westerhof wrote: > Cecil Westerhof writes: >>> With the SQL given the reader does not have a chance to identify the >>> full criteria that select the value "used" because you do not see the >>> sorting criteria. I would rather put the "ORDER BY" into the query. (Or >>> make it a query with "MIN" depending on schema.) >> >> At least prepending MIN_ would be a good idea. > > On second thought: the name is OLDEST_USED. I think that is clear > enough. ;-) You are missing the point: I was suggesting to use a query that uses aggregate function MIN() to select the needed value - if the schema does support that. Since you did not disclose the view and table definitions I cannot be more specific. Cheers robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/