[Zope] Complex SQL query

Thomas Bennett bennetttm at appstate.edu
Fri Jan 14 16:58:13 EST 2005


You didn't SELECT table2.colum2 or table2.column3 so it probably doesn't
exist for your comparison.  I don't know if the DateTime may be giving
any problem.

On Fri, 2005-01-14 at 15:42, =?UNKNOWN?Q?Jos=E9?= Monte wrote:
> Hit here.
> 
> I'v 2 databases (GadFly) that have different data.
> I wish to join some data using a ZSQL method.
> 
> I have something like:
> 
> SELECT table1.colum1, table2.colum1
> FROM table1, table2
> WHERE table1.colum1 = table2.colum1
> 
> Until this step everything is working fine...
> The problem appears when I want to compare the result of the above query 
> (taht is working ok) with some data that only exists in the table2 and in 
> table1.
> 
> I want to get some data from the table1 that I compare in table2 
> (table1.colum1 = table2.colum1) and them I only want the data that the in 
> the table1.colum1 is equal to 1 and 2 and in the table2 where above 0 (zero) 
> in the colum2 and the colum3 < than the actual date.
> 
> I try to put something like:
> 
> SELECT table1.colum1, table2.colum1
> FROM table1, table2
> WHERE table1.colum1 = table2.colum1 AND table2.colum2 > 0 AND table2.colum3 
> < <dtml-var expr="_.float(_.DateTime())"> AND table1.colum1 = 1 OR 
> table1.colum1 = 2
> 
> This query is getting ZOPE to time out and it only works again with a 
> restart...
> 
> Can anyone help me with this?
> 
> Thanks a lot,
> 
>   Jos Monte
> 
> P.S. - sorry for my extremely bad english.
> 
> _________________________________________________________________
> Express yourself with cool new emoticons http://www.msn.co.uk/specials/myemo
> 
> _______________________________________________
> Zope maillist  -  Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )



More information about the Zope mailing list