Re: sql question
Posted in 1999
On Thu, 25 Feb 1999, Yan Zhu wrote: > hey guys, could someone help me out in doing the following sql? > > table a: > autonumber k1 (primary key) > interger policyid > fld1, fld2, fld3 ... > > table b: > autonumber k2 (primary key) > interger a_id ( foreign key to k1 in table a) > fld1, fld2, fld3 > > table c: > autonumber k3 (prmary key) > interger b_id (foreign key to k2 in table b) > fld1, fld2, fld3 > > > Now I want to construct a sql whose output would be all table c >record whose correspoding table a record 's policyid is "123" for >example. > > basically, c is related to b, b is related to a, the critiera is on >a. This is very basic SQL. SELECT c.* FROM a, b, c WHERE a.policyid = 123 AND a.k1 = b.a_id AND b.k2 = c.b_id Yours, Jonathan Leffler (jleffler@informix.com) #include <wish/I/was/skiing.h> Guardian of DBD::Informix v0.60 (v0.61_02) -- http://www.perl.com/CPAN Informix IDN for D4GL & Linux -- http://www.informix.com/idn