Lookup stage

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
shilpa79
Participant
Posts: 131
Joined: Thu Jan 20, 2005 5:59 pm
Location: Virginia

Lookup stage

Post 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,
nick.bond
Charter Member
Charter Member
Posts: 230
Joined: Thu Jan 15, 2004 12:00 pm
Location: London

Re: Lookup stage

Post 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 
Regards,

Nick.
Post Reply