[Zope] SQL: nested select

vsbabu@vsbabu.org vsbabu@vsbabu.org
Mon, 19 Aug 2002 12:47:50 -0400


Hi,

Wouldn't this work?
  select * from models
    <dtml-sqlgroup where>
      <dtml-sqltest foo type=nb optional>
    <dtml-and>
      <dtml-sqltest bar type=nb optional>
    <dtml-and>
      name = (select name from users where
      uid = <dtml-sqlvar uid type=int )
    </dtml-sqlgroup>

Satheesh Babu
http://vsbabu.org/

On Mon, Aug 19, 2002 at 11:00:44AM -0400 or thereabouts, Bryan C. Andregg wrote:
> I'm trying to generate a SQL query that includes a nested select tag,
> something like
> 
> select * from models where name =
>   ( select name from users where uid = <dtml-sqlvar uid type=int )
> 
> I can do this easily by itself, but I'd like to be able to use this with some
> other optional parameters controled by a sqlgroup tag,
> 
> select * from models
>   <dtml-sqlgroup where>
>     <dtml-sqltest foo type=nb optional>
>   <dtml-and>
>     <dtml-sqltest bar type=nb optional>
>   <dtml-and>
>     ... My Test Here ...
>   </dtml-sqlgroup>
> 
> How does one nest that select call in the DTML?
> 
> Cheers,
> -- 
> Bryan C. Andregg		Duke University Medical Center
>  Programmer			Dept. of Anesthesiology
>  e <bryan.andregg@duke.edu>
>  p +1 919 684 6201