I have a query that I need to have it converted in SQL. Been searching on doing this for some time now but nothing is successful here is the ORACLE query
SELECT
DRKY AS REASON_CODE,
DRDL01 AS DESCRIPTION
FROM shema.SourceTable
WHERE drsy = '00' AND DRDL01 IS NOT NULL AND (drrt = 'W4' OR drrt = 'W5') and NVL ( trim(DRKY), '000') = '801';
This is my Linq query that does not return value
var RJDEReasonCode = from a in JTable.SourceTable
where
a.DRSY.Equals( "00") &&
a.DRDL01 != null &&
(a.DRRT.Equals( "W4") ||
a.DRRT.Equals( "W5")) &&
a.DRKY.Equals( "801") // here is where the problem is tried many things but nothing has worked so far.
select new
{
CATEGORY_CODE = a.DRRT,
REASON_CODE = a.DRKY,
DESCRIPTION = a.DRDL01
};
It looks like you just need to trim DRKY
:
a.DRKY.Trim() == "801"
Or possibly:
a.DRKY != null && a.DRKY.Trim() == "801"
(Personally I find ==
for string comparisons to be simpler than using Equals
, but YMMV.)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.