Question
Am I doing this correctly ?
My first query joins two tables and retrieves the PO and
item1 :
<cfquery name="qryGetprismReceipts" datasource="dbName">
select
PO,
item1,
urdn_number
from prismReceipts inner join test_URDN
on prismReceipts.matDoc = test_URDN.tracking_number
</cfquery>
If matches are found in the first query, I perform this query to retrive the Pgr, vendor, purchDoc, item, and netPrice,
comparing the purchDoc and Item of the openPO table to the PO and item1 from the first query.
<cfif qryGetPrismReceipts.recordcount is not 0>
<cfquery name="qryGetOpenPO" datasource="dbName">
select
Pgr,
vendor,
purchDoc,
item
netPrice
from OpenPO
where purchDoc = '#qryGetPrismReceipts.PO#'
and item = '#qryGetPrismReceipts.item1#'
</cfquery>
</cfif>
If matches are found with the above query, the following update is performed, using values obtained from the above (2nd query) :
<cfif qryGetOpenPO.recordcount is not 0>
<cfquery name="qryUpdateURDN" datasource="dbName">
update test_UnReceivables_urdn
set buyer_number = '#qryGetOpenPO.Pgr#',
supplier_number = '#qryGetOpenPO.vendor#',
Raytheon_PO_Number = '#qryGetOpenPO.purchDoc#',
item = '#qryGetOpenPO.item#',
value_amount = '#qryGetOpenPO.netPrice#'
where urdn_nubmer = '#qryGetPrismReceipts.urdn_number#'
</cfquery>
</cfif>
My question is do I need loops for any of the queries, and does the update part need a loop ?
<cfquery name="qryGetprismReceipts" datasource="dbName">
select
PO,
item1,
urdn_number
from prismReceipts inner join test_URDN
on prismReceipts.matDoc = test_URDN.tracking_number
</cfquery>
If matches are found in the first query, I perform this query to retrive the Pgr, vendor, purchDoc, item, and netPrice,
comparing the purchDoc and Item of the openPO table to the PO and item1 from the first query.
<cfif qryGetPrismReceipts.recordcount is not 0>
<cfquery name="qryGetOpenPO" datasource="dbName">
select
Pgr,
vendor,
purchDoc,
item
netPrice
from OpenPO
where purchDoc = '#qryGetPrismReceipts.PO#'
and item = '#qryGetPrismReceipts.item1#'
</cfquery>
</cfif>
If matches are found with the above query, the following update is performed, using values obtained from the above (2nd query) :
<cfif qryGetOpenPO.recordcount is not 0>
<cfquery name="qryUpdateURDN" datasource="dbName">
update test_UnReceivables_urdn
set buyer_number = '#qryGetOpenPO.Pgr#',
supplier_number = '#qryGetOpenPO.vendor#',
Raytheon_PO_Number = '#qryGetOpenPO.purchDoc#',
item = '#qryGetOpenPO.item#',
value_amount = '#qryGetOpenPO.netPrice#'
where urdn_nubmer = '#qryGetPrismReceipts.urdn_number#'
</cfquery>
</cfif>
My question is do I need loops for any of the queries, and does the update part need a loop ?
