alter table table_name add unique (TransactionNo, Register);

it will create a compound key that gurantees that only one combination of transactionNo and Register is allowed


chris

On Tue, Oct 27, 2009 at 11:28 AM, Ogure Obunga <write2ogush@gmail.com> wrote:
Hi,

My database table looks like this

TransactionID         TransactionNo          Register
1                               23/2009                     Probate
2                               23/2009                     Administration
3                               25/2009                     Finance
4                               26/2009                     Strategy

TransactionID is the primary key and is autogenerated. A register can only hold a unique TransactionNo though different registers can share the same TransactionNo. Is there a way that I can make TransactionNo field to be unique, and is there a way of coming up with a Primary Key Alias to represent the unique TransactionNo for each Register?

Regards.

Ouya Obunga

_______________________________________________
Skunkworks mailing list
Skunkworks@lists.my.co.ke
http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks
------------
Skunkworks Rules
http://my.co.ke/phpbb/viewtopic.php?f=24&t=94
------------
Other services @ http://my.co.ke
Other lists
-------------
Announce: http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks-announce
Science:  http://lists.my.co.ke/cgi-bin/mailman/listinfo/science
kazi:     http://lists.my.co.ke/cgi-bin/mailman/admin/kazi/general