Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Cecil Westerhof Newsgroups: comp.lang.java.programmer Subject: Re: Where to put the return Date: Sat, 19 Aug 2017 17:06:50 +0200 Organization: Decebal Computing Lines: 27 Message-ID: <87valjha0l.fsf@munus.decebal.nl> 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 Injection-Info: mx02.eternal-september.org; posting-host="3820b20d39a2e7728f71dbc5da182e9b"; logging-data="21539"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/ZFJ7r7ABPr61qhkCYH9Ct+buQV9EpG1M=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) X-Homepage: http://www.decebal.nl/ Cancel-Lock: sha1:nMf/JaLs+LC9Fp0WgAPlAj/UfkE= sha1:639GNqJUiYgVd/CJuaVwgkf7QKk= Xref: csiph.com comp.lang.java.programmer:37288 Robert Klemme writes: > 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. Of-course: you are completely right, that is much better. I changed it. Should have done it like that to begin with. -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof