Database Query with no key values

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
Marley777
Premium Member
Premium Member
Posts: 316
Joined: Tue Jan 27, 2004 3:26 pm

Database Query with no key values

Post by Marley777 »

I am trying to combine input from a transformer stage along with a max id value from a db2 table in datastage. The information in the two inputs is not related to do a lookup on a key value. Has anyone ever done this?
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Use a pseudo column with a literal value as the key in your select max query. Now do the lookup using the literal value.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Marley777
Premium Member
Premium Member
Posts: 316
Joined: Tue Jan 27, 2004 3:26 pm

Post by Marley777 »

What do you mean by pseudo column?
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

A pseudo column:

Code: Select all

select 'I am not a real column' "NOT_REAL_COLUMN", max(primary_key) "MAX_KEY" from your_table"
will return two columns of data: NOT_REAL_COLUMN and MAX_KEY in your result set.

A pseudo column is a literally defined column that doesn't exist in the underlying data. You supply an alias to give it a name. A very elementary SQL technique.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Post Reply