[ic] Cascaded query against multiple tables

Mike Heins interchange-users@icdevgroup.org
Wed Jul 2 14:06:01 EDT 2003


Quoting Interchange User (interchange@framework.cx):
> Greetings,
> 	
> IC 4.9.8 nightly, MySQL 4.1
> 
> I need to run a query against table1.  Based on what I find there, I  
> need to take the results, and search with them against table2 and  
> table3.
> 
> Table1 has a list of authors, with an index into articles they have  
> written. I need to search the authors list for an author's name (via a  
> text input), then, once I have that information, I need to hit table2  
> and pull out all articles they have written, and table3, which contains  
> supplemental information on the articles (which I can do with a join).   
> I know I can do a join for the second query, but I don't know how to  
> access the results from the second part of the query as search criteria  
> using ITL.  Does anyone have any examples of this?
> 
> In MySQL, I would first
> 
> select articleid from nc_authorarticle where authordisplay like  
> "%some_author's_name_here%";
> 

This is just a MySQL question. Here is a query example that works
on the IC foundation demo with MySQL 4:

<xmp>
[query
    list=1
    table=products
    sql=|
        select p.sku,p.price,p.description
        from products as p
        where p.sku in (
                select m.sku from merchandising as m
                where m.featured = 'specials'
              )
    |
][sql-line]
[/query]
</xmp>

-- 
Mike Heins
Perusion -- Expert Interchange Consulting    http://www.perusion.com/
phone +1.513.523.7621      <mike@perusion.com>

Nature, to be commanded, must be obeyed. -- Francis Bacon



More information about the interchange-users mailing list