Re: simple (?) join

From: justin <justin(at)emproshunts(dot)com>
To: "Oliveiros C," <oliveiros(dot)cristina(at)marktest(dot)pt>
Cc: pgsql-sql(at)postgresql(dot)org, gary(dot)stainburn(at)ringways(dot)co(dot)uk
Subject: Re: simple (?) join
Date: 2009-09-26 18:53:24
Message-ID: 4ABE6324.3060601@emproshunts.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-sql

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<br>
<br>
Oliveiros C, wrote:
<blockquote
cite="mid:1EF7ADDE66AA4D4E8E7EB2021CAD6CBB(at)marktestcr(dot)marktest(dot)pt"
type="cite">
<meta http-equiv="Content-Type" content="text/html; ">
<meta content="MSHTML 6.00.5730.13" name="GENERATOR">
<style></style>
<div><font face="Arial" size="2">Hello, Justin, Gary.</font></div>
<div>&nbsp;</div>
<div><font face="Arial" size="2">Justin, your&nbsp;(the second one) query
is not much different from mine.</font></div>
</blockquote>
No its not,&nbsp; <br>
<blockquote
cite="mid:1EF7ADDE66AA4D4E8E7EB2021CAD6CBB(at)marktestcr(dot)marktest(dot)pt"
type="cite">
<div><font face="Arial" size="2">&nbsp;You&nbsp;previewed &nbsp;the possibility of
having orders without any&nbsp;matching entry on orders_log with your left
join, something that I haven't. Gary, will you have</font></div>
<div><font face="Arial" size="2">records on your orders table that
don't reference any record on your orders_log table? If so, Justin's
query is the right one you should use.</font></div>
<div>&nbsp;</div>
<div><font face="Arial" size="2">You return the full record from
orders and an additional column from orders_log, the&nbsp;ol_timestamp
column. I understood that Gary wanted the full record from orders_log,
not</font></div>
<div><font face="Arial" size="2">just the timestamp column. That
part&nbsp;is done by my subquery .</font></div>
<div>&nbsp;</div>
<div><font face="Arial" size="2">&nbsp;I think Gary could clarify what he
wants exactly. Gary? :)</font></div>
</blockquote>
Yes gary please do if these do not answer your questions???<br>
<blockquote
cite="mid:1EF7ADDE66AA4D4E8E7EB2021CAD6CBB(at)marktestcr(dot)marktest(dot)pt"
type="cite">
<div>&nbsp;</div>
<div><font face="Arial" size="2">Also, Justin, your query
design&nbsp;seems right to me, but maybe you should add this (the part in
comment)&nbsp;to your subquery </font></div>
<div>SELECT MAX(ol_timestamp) /* as ol_timestamp */ , o_id FROM
orders_log group by o_id </div>
<div>because the MAX(ol_timestamp) will receive the name max, not
ol_timestamp, and probably</div>
<div>the parser will complain that column&nbsp;ol_timestamp&nbsp; does not
exist.</div>
<div>Ain't I&nbsp;right?</div>
</blockquote>
<br>
Yes you are correct i forgot to add the AS <br>
</body>
</html>

Attachment Content-Type Size
unknown_filename text/html 2.4 KB

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message justin 2009-09-26 18:54:24 Re: simple (?) join
Previous Message Claus Guttesen 2009-09-25 22:36:16 Re: simple (?) join