Re: CONSTRUCT with multible tables?
Posted in 1994
Topics: SQL Development & Query Writing
Harry Skelton (zorba@netcom.com) wrote: : [stuff omitted] : 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" : : 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. As several people already suggested, you could use an outer join. What I did in a similar situation was something like: CONSTRUCT . . . IF construct_clause contains "table2" THEN LET tables = "table1, table2" ELSE LET tables = "table1, OUTER table2" END IF and use both tables and the construct_clause to build my query. I don't know what you mean by inconsistant, unless you simply mean you don't always get the rows in the same order, in which case you need an "ORDER BY" clause. Ned Bush (nedbush@gate.net)