Re: [SQLObject] left join with subquery and WHERE

2010-05-14 Thread Imre Horvath
On Fri, 2010-05-14 at 19:21 +0400, Oleg Broytman wrote: > On Fri, May 14, 2010 at 04:43:46PM +0200, Imre Horvath wrote: > > sqlite> select * from pricegroups > >...> left join (select * from products_pricegroups > >...> where products_pricegroups.product_id=1) as a > >...> on (pricegr

Re: [SQLObject] left join with subquery and WHERE

2010-05-14 Thread Oleg Broytman
On Fri, May 14, 2010 at 04:43:46PM +0200, Imre Horvath wrote: > sqlite> select * from pricegroups >...> left join (select * from products_pricegroups >...> where products_pricegroups.product_id=1) as a >...> on (pricegroups.id=a.pricegroup_id); I don't understan what is aliased as

Re: [SQLObject] left join with subquery and WHERE

2010-05-14 Thread Imre Horvath
On Fri, 2010-05-14 at 18:24 +0400, Oleg Broytman wrote: > On Fri, May 14, 2010 at 06:22:05PM +0400, Oleg Broytman wrote: > > On Fri, May 14, 2010 at 03:37:46PM +0200, Imre Horvath wrote: > > > select * from pricegroups > > > left join (select * from products_pricegroups > > > where products_priceg

Re: [SQLObject] left join with subquery and WHERE

2010-05-14 Thread Oleg Broytman
On Fri, May 14, 2010 at 06:22:05PM +0400, Oleg Broytman wrote: > On Fri, May 14, 2010 at 03:37:46PM +0200, Imre Horvath wrote: > > select * from pricegroups > > left join (select * from products_pricegroups > > where products_pricegroups.product_id=1) as a > > on (pricegroups.id=a.pricegroup_id)

Re: [SQLObject] left join with subquery and WHERE

2010-05-14 Thread Oleg Broytman
On Fri, May 14, 2010 at 03:37:46PM +0200, Imre Horvath wrote: > select * from pricegroups > left join (select * from products_pricegroups > where products_pricegroups.product_id=1) as a > on (pricegroups.id=a.pricegroup_id) Currently it's impossible to do with SQLObject as it assumes both sid

[SQLObject] left join with subquery and WHERE

2010-05-14 Thread Imre Horvath
Hi! I wrote a small program to test this problem. I have 3 tables: CREATE TABLE pricegroups (id integer primary key); CREATE TABLE products (id integer primary key, name text); CREATE TABLE products_pricegroups (id integer primary key, product_id integer, pricegroup_id integer, percent integer);

Re: [SQLObject] LEFT JOIN

2007-05-08 Thread Christopher Singley
On Tuesday 08 May 2007 19:53, [EMAIL PROTECTED] wrote: > On Tue, 8 May 2007 at 18:27, Christopher Singley wrote: > > On Tuesday 08 May 2007 12:08, Jim Steil wrote: > >> What I'm > >> trying to do is get a list of requisitions sorted by plant name. > > > > Why not get a list of requisitions, and the

Re: [SQLObject] LEFT JOIN

2007-05-08 Thread rdmurray
On Tue, 8 May 2007 at 18:27, Christopher Singley wrote: > On Tuesday 08 May 2007 12:08, Jim Steil wrote: >> What I'm >> trying to do is get a list of requisitions sorted by plant name. > > Why not get a list of requisitions, and then sort it by plant name? > > list(Requisition.select()).sort(key =

Re: [SQLObject] LEFT JOIN

2007-05-08 Thread Christopher Singley
On Tuesday 08 May 2007 12:08, Jim Steil wrote: > What I'm > trying to do is get a list of requisitions sorted by plant name. Why not get a list of requisitions, and then sort it by plant name? list(Requisition.select()).sort(key = lambda x: x.plant.name) cs -

[SQLObject] LEFT JOIN

2007-05-08 Thread Jim Steil
Hi: I have the following classes and would like to create a left join so that I can sort by the plant 'name' field class Requisition(SQLObject): class sqlmeta: style = Style(longID=True) idName = 'requisitionId' plant = ForeignKey('Plant', dbName='plantId') re