December 23, 2008 at 4:17 pm
This won't return any data. The chargeoffdate attribute is formatted YYYY-MM-DD.
WITH XMLNAMESPACES ('http://xml.TT.com/transaction' AS xtt)
Select
XMLData.query('
declare namespace xtt="http://xml.teletrack.com/transaction";
for $TT in /TransactionResponseEntity/
where ($TT/@ChargeOffDate) =
max(/TransactionResponseEntity/@ChargeOffDate)
return $TT') as max_date
FROM
TTData
WHERE
ID = 3
This will work if I hard code the date.
WITH XMLNAMESPACES ('http://xml.TT.com/transaction' AS xtt)
Select
XMLData.query('
declare namespace xtt="http://xml.teletrack.com/transaction";
for $TT in /TransactionResponseEntity/
where ($TT/@ChargeOffDate) =
max("2008-01-12", "2008-01-13") as max_date
FROM
TTData
WHERE
ID = 3
If I do a max on an integer attribute it will work.
WITH XMLNAMESPACES ('http://xml.TT.com/transaction' AS xtt)
Select
XMLData.query('
declare namespace xtt="http://xml.teletrack.com/transaction";
for $TT in /TransactionResponseEntity/
where ($TT/@ChargeOffAmt) =
max(/TransactionResponseEntity/@ChargeOffAmt)
return $TT') as max_date
FROM
TTData
WHERE
ID = 3
I want to get the maximum date attribute, but it seems that the max won't work on dates. Any help would be very appreciated.
December 24, 2008 at 9:52 am
I'm new to xml querying, so please help if you have any ideas.
I did some more troubleshooting and the namespace doesn't define the data attribute as a date type. I can't change the namespace, so it converts it to a decimal type it doesn't get the max. I can't seem to convert it to a string. Any help would be greatly appreciated.
Thanks!
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply