Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news-1.dfn.de!news.dfn.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Chris Riesbeck Newsgroups: comp.lang.java.databases Subject: Re: joining Date: Fri, 08 Aug 2014 11:55:25 -0500 Lines: 26 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net Wt9+6usHBMPvGUroD+qpxQoOLlYqP3VQhuZnPZmJJitC1mQEZM Cancel-Lock: sha1:hBHuhrJ7hC2CWWChMVv8cZ1BiuU= User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 In-Reply-To: Xref: csiph.com comp.lang.java.databases:682 On 8/8/2014 8:54 AM, Lothar Kimmeringer wrote: > Roedy Green wrote: > >> I suspect it might be faster/better to get SQL to join the records for >> me and present me with one unified record. > > If you mean resultset when speaking of record, it is. > >> Is that a better approach and if so, what does a query look like given >> each record has a unique integer key? > > Not sure, where the java-related question is, but the statement > would look like this: > > > select a.name, b.quote from authors a, quotes b > where a.id = b.id_author Or, select a.name, b.quote from authors a join quotes b on a.id = b.id_author I prefer using JOIN for joins and WHERE clauses for other constraints. Also makes it easier to modify the type of JOIN if that becomes an issue.