Question
Why can't I find any matches ?
My first query select PONumber and itemNO from table1 based
on the document number entered in the form.
<cfquery name="qryName1" datasource="dbName">
select
PONumber,
rtrim(itemNo) as itemNo
from table1
where documentNo = '#form.documentNumber#'
</cfquery>
I then take the two fields retrived and match it against this table, to get the pGR and netPrice.
<cfquery name="qryName2" datasource="dbName">
select pGr, netPrice
from OpenPO
where
(purchDoc = '#qryName1.PONumber#' and Item = '#TRIM(qryName1.itemNo)#')
</cfquery>
What is happending is that the PONumber matches but the itemNo does not match. That is why I rtrim in the sql in the first query and trim in the where clause in this query but it still does not find a match. Both items are defiend as nvarchar 5 in the sql tables. I even used cfoutput to show the len and it is 5, so there are no blank spaces, yet it still will not find a match, and I know there are matches.
Any anybody tell me what is wrong and/or what to look for ?
<cfquery name="qryName1" datasource="dbName">
select
PONumber,
rtrim(itemNo) as itemNo
from table1
where documentNo = '#form.documentNumber#'
</cfquery>
I then take the two fields retrived and match it against this table, to get the pGR and netPrice.
<cfquery name="qryName2" datasource="dbName">
select pGr, netPrice
from OpenPO
where
(purchDoc = '#qryName1.PONumber#' and Item = '#TRIM(qryName1.itemNo)#')
</cfquery>
What is happending is that the PONumber matches but the itemNo does not match. That is why I rtrim in the sql in the first query and trim in the where clause in this query but it still does not find a match. Both items are defiend as nvarchar 5 in the sql tables. I even used cfoutput to show the len and it is 5, so there are no blank spaces, yet it still will not find a match, and I know there are matches.
Any anybody tell me what is wrong and/or what to look for ?
