I am buidling a form and basically I am having it do one query and if that doesn't return the necessary information it queries another table to get it.
CODE
<cfquery name="reservationinfo" datasource="#mydatasource#" username="#myusername#" password="#mypassword#">
SELECT pickupdate,pickuptime,pickupfrom,pickupname,pickupcompany,pickupaddress,pickupsu
ite_flr_apt,pickupcity,pickupstate,chauffeurmeet,pickupairportname,pickupairline
terminal,pickupflightnumber,pickupdeparturecity FROM travelreservations WHERE cuuid = <cfqueryparam value="#session.cuuid#"> AND rid = <cfqueryparam value="#session.rid#">
</cfquery>
<cfif reservationinfo.pickupdate lte "">
<cfquery name="reservationinfo" datasource="#mydatasource#" username="#myusername#" password="#mypassword#">
SELECT fname,
lname,
company AS pickupcompany,
address1 AS pickupaddress,
address2 AS pickupsuite_flr_apt,
city AS pickupcity,
state AS pickupstate
FROM travelMembers WHERE cuuid = <cfqueryparam value="#session.cuuid#">
</cfquery>
<cfset reservationinfo.pickuname = #reservationinfo.fname# & " " & #reservationinfo.lname#>
<cfquery name="reservationinfo" datasource="#mydatasource#" username="#myusername#" password="#mypassword#">
SELECT pickupdate,pickuptime,pickupfrom,chauffeurmeet,pickupairportname,pickupairlinete
rminal,pickupflightnumber,pickupdeparturecity FROM travelreservations WHERE cuuid = <cfqueryparam value="#session.cuuid#"> AND rid = <cfqueryparam value="#session.rid#">
</cfquery>
</cfif>
<cfdump var="#reservationinfo#">
On the first SQL query after the CFIF statement I need fname and lname to be joined as pickupname. I would just use a bunch of CFSET's and use those variables but at this point that would be too much code that I only want to do if need be. So I don't know if there is a SQL keyword that I could use for it or not but thanks for your help.