Two unique key in one table

  • I have two unique keys in one table and I want to write a query that connects me to two unique keys and displays them in one record. Right now, the question returns 2 records to me where unique key = ID in the first and unique key = PM in the second record. And I would like to have one record unique key = ID. I want to try the Procedure described here but I'm scared that I am doing wrong. Can someone give some insight here?

    i.COLNAMES  AS CCOLUMNS, C.TABNAME
    FROM syscat.columns C
    JOIN SYSCAT.INDEXES I ON I.TABNAME = C.TABNAME
    WHERE UNIQUERULE IN ('P','U')
  • Thanks for posting your issue and hopefully someone will answer soon.

    This is an automated bump to increase visibility of your question.

  • This was removed by the editor as SPAM

  • Piyushbhatt wrote:

    I have two unique keys in one table and I want to write a query that connects me to two unique keys and displays them in one record. Right now, the question returns 2 records to me where unique key = ID in the first and unique key = PM in the second record. And I would like to have one record unique key = ID. I want to try the Procedure described here but I'm scared that I am doing wrong. Can someone give some insight here?

    i.COLNAMES  AS CCOLUMNS, C.TABNAME
    FROM syscat.columns C
    JOIN SYSCAT.INDEXES I ON I.TABNAME = C.TABNAME
    WHERE UNIQUERULE IN ('P','U')

    This does not run on my SQL Server system (even when prepended with SELECT). Which database platform are you using?

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • syscat is DB2

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply