select table1.field1 as t1f1,table2.field1 as t2f1 from table1,table2 where table1.key=table2.key
hth ----- Original Message ----- From: "Brian Scandale" <[EMAIL PROTECTED]> To: "CF-Talk" <[EMAIL PROTECTED]> Sent: Wednesday, March 20, 2002 3:06 AM Subject: sql and alias names > I have a query that is giving me a bit of a problem. > > <cfquery datasource="#request.theDSN#" name="theHistory"> > SELECT * > FROM History > LEFT OUTER JOIN Op ON History.Op_ID = Op.Op_ID > LEFT OUTER JOIN TravelerD ON History.TravelerD_ID = TravelerD.TravelerD_ID > LEFT OUTER JOIN Notes ON History.History_ID = Notes.History_ID > WHERE History.Device_ID = #theLot.Device_ID# > ORDER by History.Date_Out > </cfquery> > > > TravelerD and Notes both share a field named TravelerD_ID. > > When there is not a matching Notes record, theHistory.TravelerD_ID from the query field ends up empty even though there is a TravelerD record that matches the query... the 2nd left outer join relates to it. > > How does one query tables that share common field names in this case. I can't seem to work out the alias technique here. > > As an aside.... > history.op_id ALWAYS has a match in op > history.travelerd_id does NOT always have a match in travelerd > history.history_id does NOT always have a match in notes > am I using the Left Outer Join properly here? > > thanks, > Brian > > > > > > ______________________________________________________________________ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/[email protected]/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

