Oleg Broytmann <phd <at> mail2.phd.pp.ru> writes:

> 
> On Wed, Apr 19, 2006 at 01:10:36AM +0100, spamfree <at> eircom.net wrote:
> > I've been through the documentation and all the examples of JOINS just
> > have results from a single table. 
> 
>    JOINs can use as many tables as you want. Examples:
> 
> Stright join:
>    Table1.select(AND(Table1.q.id==Table2.q.t1_id, Table2.q.name=="value"))
> 
> LEFT JOIN:
>    Table1.select(join=LEFTJOIN(Table2, Table3))
> 
> Oleg.


Hi,
  I have used both examples in interactive Python shell with debug turned on
("postgres://mike:@localhost/mike?debug=1&debugOutput=1"). Selected fields are
only returned from the first table.

Here's an example.
I have 2 simple tables with telephone call data. I want to select all fields
from both tables. So i run the following

>>> result = Call.select(AND(Call.q.id == Make.q.callsID, Call.q.code == "M"))

>>> result[1]
 1/Select  :  SELECT call.id, call.date_time, call.duration, call.code FROM
make, call WHERE ((call.id = make.calls_id) AND (call.code = 'M')) LIMIT 1 
OFFSET 1


The output I'm looking for is something like
SELECT call.col1, call.col2 .... call.coln, make.col1 ... make.coln FROM make,
call WHERE ((...............

Thanks
Mike




-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to