Path: csiph.com!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 23:26:43 +0200 Lines: 34 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: quoted-printable X-Trace: individual.net zdbJQAXG3DsmEJw+fM4t+gXVRM1AA0XOaE44QMS+zP3j0cC7g= Cancel-Lock: sha1:KQhWi54DtAzVWkS4WOKzYWHbPcY= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 In-Reply-To: Content-Language: en-US Xref: csiph.com comp.lang.java.programmer:37301 On 19.08.2017 15:48, Arne Vajh=C3=B8j wrote: > 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 th= e >>>>> full criteria that select the value "used" because you do not see t= he >>>>> sorting criteria. I would rather put the "ORDER BY" into the=20 >>>>> 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=20 >> aggregate function MIN() to select the needed value - if the schema=20 >> does support that. Since you did not disclose the view and table=20 >> definitions I cannot be more specific. >=20 > MIN has to be there. It is basic SQL. I said "depending on schema" - not database product or SQL dialect. Cheers robert --=20 remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/