Path: csiph.com!aioe.org!.POSTED!not-for-mail From: =?UTF-8?Q?Arne_Vajh=c3=b8j?= Newsgroups: comp.lang.java.programmer Subject: Re: Where to put the return Date: Sat, 19 Aug 2017 09:48:59 -0400 Organization: Aioe.org NNTP Server Lines: 23 Message-ID: References: <87zib6zeup.fsf@munus.decebal.nl> <87y3qlnyvj.fsf@munus.decebal.nl> <87bmnbj09u.fsf@munus.decebal.nl> <877exzixum.fsf@munus.decebal.nl> NNTP-Posting-Host: PBuS014lhzVyHjLbXmo/ZQ.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 Content-Language: en-US X-Notice: Filtered by postfilter v. 0.8.2 Xref: csiph.com comp.lang.java.programmer:37287 On 8/19/2017 9:35 AM, Robert Klemme wrote: > 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. MIN has to be there. It is basic SQL. Arne