Coast Line
asked on
Merge two queries into one
I want to merge the query into one
select id
from dbo.table1 with(nolock)
where cid = 622
if recordfromabove neq form.value then proceed the follow code
update table1
set id = 22
where cid = 622
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
both the above are failing, if i try, think it like this
<cfquery name="getinfo">
select id
from dbo.table1 with(nolock)
where cid = 622
</cfquery>
<cfif GetInfo.id NEQ arguments.id>
update table1
set id = #arguments.id#
where cid = 622
</cfif>
I see no need to select the id first then update. A single update should work fine.
Can you post sample data and expected results based on the arguments.id value selected?
Can you post sample data and expected results based on the arguments.id value selected?
ASKER
Open in new window