db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Cox" <j...@cwindustries.net>
Subject RE: autoincrement of non primary key
Date Thu, 04 Mar 2004 04:55:29 GMT
Unless I am missing something, <unique> only makes the individual field
unique. What I need is the combination to be unique. In other words... 

If 
SESSION_ID = 10
SECTION_ID = 15
ACTIVITY_ID = 25

then 10, 15, and 25 can't be again used together.. but

SESSION_ID = 10
SECTION_ID = 15
ACTIVITY_ID = 30

Would work because even though SESSION_ID and SECTION_ID have been 10
and 15 before, they have not been in combination with 30.

I could just make ID the key but then the following would be allowed

ID = 1
SESSION_ID = 10
SECTION_ID = 15
ACTIVITY_ID = 25

ID = 2
SESSION_ID = 10
SECTION_ID = 15
ACTIVITY_ID = 25

Etc. etc.... 

Jeff

-----Original Message-----
From: Dave Newton [mailto:dave@solaraccess.com] 
Sent: Wednesday, March 03, 2004 9:10 PM
To: Apache Torque Users List
Subject: RE: autoincrement of non primary key

On Wed, 2004-03-03 at 20:52, Jeff Cox wrote:
> Dale,
>     First let me say I really appreciate you responding to my
question.
> Secondly, I would agree with you and in fact considered that
possibility
> early on in the design, but the truth is I need any given combination
of
> (SESSION_ID, SECTION_ID, ACTIVITY_ID) to be unique. I don't know of
> another way to enforce this in the schema, except by making them the
> primary key. If there is another way to do this my problem would
> certainly be solved...

The <unique> stuff doesn't work?

Wait, you need _any_combination_ of those three values to be unique? I
don't get it. If any combination of those needs to be unique then you
only need one number.

Dave



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message