Hello,

I have a schema like this:

class Order(SQLObject):
        date =                  DateTimeCol(default=datetime.now())
        about =                         UnicodeCol(default=None)        
        orderproducts =         MultipleJoin('OrderProduct')
        person =                RelatedJoin('Person')

class OrderProduct(SQLObject):
        code =                  UnicodeCol()
        name =                  UnicodeCol()

class Person(SQLObject):
        name =                  UnicodeCol()

Now I'd like to select orders based on a keyword like this:

order_list = list(
        Order.select(
                AND(
                        OR(
                                OrderProduct.q.name.contains('i'),
                                Person.q.name.contains('i'))
                        Order.q.id==OrderProduct.q.orderID,
                        Order.q.personID==Person.q.id)))

This gives me back the orders quantified by all the orderproducts which were found. I can do a distinct on the end to get only one back, but then the performance gets very poor. Is there a better way to do this?

Koen

Attachment: smime.p7s
Description: S/MIME cryptographic signature

-------------------------------------------------------------------------
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