On Thu, Nov 29, 2007 at 07:44:50AM +0100, Petr Jake?? wrote:
> for cust in Customer.select(Customer.q.city.startswith('T')):
> ......
>
> Which generates:
> SELECT ...(ale tables names here).... FROM customer WHERE ((customer.city)
> LIKE ('T%'))
>
> but how can I add more conditions in to the final WHERE clause?
> I was trying for example:
>
> for cust in Customer.select(Customer.q.city.startswith('T') or
> Customer.q.city.startswith('Q') ):
You can combine conditions using AND or OR (import them from sqlobject).
Moreover q-magic automatically calls them if you combine your conditions
using Python operators || or &&
for cust in Customer.select(OR(Customer.q.city.startswith('T'),
Customer.q.city.startswith('Q'))
or
for cust in Customer.select(Customer.q.city.startswith('T') ||
Customer.q.city.startswith('Q')
Oleg.
--
Oleg Broytmann http://phd.pp.ru/ [EMAIL PROTECTED]
Programmers don't die, they just GOSUB without RETURN.
-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell. From the desktop to the data center, Linux is going
mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss