On Thu, Nov 20, 2008 at 07:34:32PM +0000, Matthew Wilson wrote:
> I have a table of employees and a table of shifts and I want to write a
> single query like this:
> 
> select emp.name, shifts.start_time
> from employees emp, shifts
> where emp.department_id = 99
> and emp.id = shifts.employee_id

http://sqlobject.org/FAQ.html#what-about-group-by-union-etc

   Not every query can be represented in SQLObject. SQLOBject's objects are
instances of "table" classes. In your example there is no a table that
describes the column of the result. You can create such a table in SQL
(it's a VIEW), create SQLObject's class for the view and use the class.

   There is also ViewSQLObject that derives all it's values from other
SQLObject classes. See
http://svn.colorstudy.com/SQLObject/trunk/sqlobject/views.py
for docstrings and
http://svn.colorstudy.com/SQLObject/trunk/sqlobject/tests/test_views.py
for examples.

Oleg.
-- 
     Oleg Broytmann            http://phd.pp.ru/            [EMAIL PROTECTED]
           Programmers don't die, they just GOSUB without RETURN.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to