Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Group Primary Keys

Status
Not open for further replies.

DB2Problem

Programmer
Oct 17, 2002
53
US
Hello All,

Can anyone tell me how to combine primary keys into one single key

Previously, my database has just one primary key (PK). But the database has gone a change with 3 new fields acting as PK.

I am using SQL like –

SELECT primary_id as pk,
secondary_field1,
secondary_field2,
FROM schema.table
WHERE primary_id = {0};

Where the primary_id is dynamically filled.

But Now I have following SQL –

SELECT secondary_field1,
secondary_field2,
secondary_field3 as pk,
secondary_field4,
secondary_field5
FROM schema.table WHERE secondary_field1= {0} and secondary_field2= {0} secondary_field3= {0};

How can I combine the above 3 PK’s (Char Datatype) into one PK (Integer Datatype)

Your suggestion is highly appreciated
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top