Re: simple (?) join
От | justin |
---|---|
Тема | Re: simple (?) join |
Дата | |
Msg-id | 4ABE6324.3060601@emproshunts.com обсуждение исходный текст |
Ответ на | Re: simple (?) join ("Oliveiros C," <oliveiros.cristina@marktest.pt>) |
Список | pgsql-sql |
<br /><br /> Oliveiros C, wrote: <blockquote cite="mid:1EF7ADDE66AA4D4E8E7EB2021CAD6CBB@marktestcr.marktest.pt" type="cite"><style></style><div><fontface="Arial" size="2">Hello, Justin, Gary.</font></div><div> </div><div><font face="Arial"size="2">Justin, your (the second one) query is not much different from mine.</font></div></blockquote> No itsnot, <br /><blockquote cite="mid:1EF7ADDE66AA4D4E8E7EB2021CAD6CBB@marktestcr.marktest.pt" type="cite"><div><font face="Arial"size="2"> You previewed the possibility of having orders without any matching entry on orders_log with yourleft join, something that I haven't. Gary, will you have</font></div><div><font face="Arial" size="2">records on yourorders table that don't reference any record on your orders_log table? If so, Justin's query is the right one you shoulduse.</font></div><div> </div><div><font face="Arial" size="2">You return the full record from orders and an additionalcolumn from orders_log, the 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 is done by my subquery .</font></div><div> </div><div><fontface="Arial" size="2"> 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@marktestcr.marktest.pt"type="cite"><div> </div><div><font face="Arial" size="2">Also,Justin, your query design seems right to me, but maybe you should add this (the part in comment) to your subquery</font></div><div>SELECT MAX(ol_timestamp) /* as ol_timestamp */ , o_id FROM orders_log group by o_id </div><div>becausethe MAX(ol_timestamp) will receive the name max, not ol_timestamp, and probably</div><div>the parser willcomplain that column ol_timestamp does not exist.</div><div>Ain't I right?</div></blockquote><br /> Yes you are correcti forgot to add the AS <br />
В списке pgsql-sql по дате отправления: