Re: CONSTRUCT with multible tables?
Posted in 1994
Topics: SQL Development & Query Writing, Java & JDBC Development
Harry Skelton <zorba@netcom.com> wrote: >I have a construct that is sorta like the following: > define where_clause char(200) > construct by name where_clause on > clnt.clnt_nmbr, > clnt.clnt_nm_1, > clnt_contact.contact_nm_1, > clnt_contact.contact_nm_2, > clnt.addr_1, > ... > let sql_var="select * from clnt,clnt_contact where ",where_clause, > " and clnt_contact.clnt_nmbr = clnt.clnt_nmbr" Minor suggestion: where_clause CLIPPED ^^^^^^^ May be important depending on the size of sql_var > This is inconsistant in it's selection. An additional problem is that I > want to select the client record, and the contact record, but if a > contact record is not present, I still want the client record anyway. Suggestion #2: Use an outer join to solve your "additional problem." If I am thinking straight it would be "FROM clnt, OUTER clnt_contact". This will select all the qualifying rows from clnt independent of whether rows from clnt_contact exist. I can't quite puzzle out what you mean by "inconsistant in it's selection" but I'm sure someone else will. :-) Cheers, -Todd >-- > Harry Skelton - 1848 Beaver Dam Lane - Marietta, Georgia - 30062 > 404-590-7100 or 800-366-8181 Work -- 404-578-8085 Home > skelton@jdp.dragon.com > "He who flames improperly risks making an ash of himself!" > --- Jeff Klumpp (jdk@ficc.uu.net) _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ = Todd A. Bernhardt Wheaton College = = bernha@david.wheaton.edu (708) 752-5232 = -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- | Don't let your schooling get in the way of your education! | | -Albert Einstein | \\_____________________________________________________________________/