Hi,

That doesn't seem to be quite what I need. I basically have two tables 
with identical headers in the SQL database (not the best design, I know, 
but it evolved that way from something a lot simpler.)

I've managed to work out what the SQL statement (Postgres) would be to 
do what I want, if that's useful:

SELECT * from (SELECT * FROM vip_comp_details UNION SELECT * FROM 
contact_details ) AS people where date > '2007-06-06' and date < 
'2007-06-07' order by date desc;

The relevant part there is SELECT * from (SELECT * FROM vip_comp_details 
UNION SELECT * FROM contact_details ), I guess.

I've not been able to find anything in the SQLObject docs for how to do 
this, so any help would be much appreciated :)


Thanks,

Nick Murdoch


TiNo wrote:
> Do a (left) join. (About joins: http://www.w3schools.com/sql/sql_join.asp)
> And on how to do it with SQLObject: 
> http://www.sqlobject.org/FAQ.html#how-can-i-do-a-left-join and 
> http://www.sqlobject.org/SQLObject.html#left-join-and-other-joins
> 
> TiNo
> 
> 2007/6/8, Nick Murdoch <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>:
> 
>     Hi all,
> 
>     I have two classes (simplified here):
> 
>     class ContactDetails(SQLObject):
>          email = UnicodeCol(alternateID=True)
> 
>     class VIPContactDetails(ContactDetails):
>          pass
> 
> 
>     Is there any way I can perform a select across both classes, something
>     like (in my head):
>     (ContactDetails & VIPContactDetails).select(...)
> 
>     The alternative seems to be to just perform a select on each class and
>     merge them together in Python, which isn't particularly convenient when
>     I intend to pass orderBy and so on into select().
> 
>     Thanks,
> 
>     Nick Murdoch
> 
>     -------------------------------------------------------------------------
>     This SF.net email is sponsored by DB2 Express
>     Download DB2 Express C - the FREE version of DB2 express and take
>     control of your XML. No limits. Just data. Click to get it now.
>     http://sourceforge.net/powerbar/db2/
>     _______________________________________________
>     sqlobject-discuss mailing list
>     sqlobject-discuss@lists.sourceforge.net
>     <mailto:sqlobject-discuss@lists.sourceforge.net>
>     https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
> 
> 

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to