Page 1 of 1

Lookup stage

Posted: Mon May 07, 2007 1:34 pm
by shilpa79
My source is XML file and I am doing lookup to pull the ID joining the creation date but I need to get the max(ID) and when I am trying to use this User-defined query from RDMS stage its not working..................

SELECT Max(schema.tblname.DocumentID),schema.tblname.Created
FROM schema.tblname
WHERE schema.tblname.Created=?

This query I am giving in lookup table.

Its a SQL server DB.

Thanks,

Re: Lookup stage

Posted: Mon May 07, 2007 4:16 pm
by nick.bond
shilpa79 wrote:My source is XML file and I am doing lookup to pull the ID joining the creation date but I need to get the max(ID) and when I am trying to use this User-defined query from RDMS stage its not working..................

SELECT Max(schema.tblname.DocumentID),schema.tblname.Created
FROM schema.tblname
WHERE schema.tblname.Created=?

This query I am giving in lookup table.

Its a SQL server DB.

Thanks,
If you're using Max you need to group by the schema.tblname.Created

Code: Select all

SELECT Max(schema.tblname.DocumentID),schema.tblname.Created 
FROM schema.tblname
WHERE schema.tblname.Created=?
group by schema.tblname.Created