Re: Incrementing a "Private" Integer Space

2007-11-25 Thread David T. Ashley
Hi Martin, The easiest way to restore context in this conversation is to go to the MySQL home page (www.mysql.com), then go to "Community", then "Lists", then to look at the archives of the main MySQL mailing list (this one). I believe at this point that Chris and Stut answered my question decisi

RE: Incrementing a "Private" Integer Space

2007-11-25 Thread Martin Gainty
Dave is trying to establish an algorithm which would fit your requirement I can see column q is auto-increment which makes sense as you retain the capability to generate a unique row but jumping into the middle of a conversation without knowing the prior discussionWhat is/was/will be the purpos

Re: Incrementing a "Private" Integer Space

2007-11-25 Thread Chris W
David T. Ashley wrote: Hi Chris, OK, I will try that. Thanks for the help. My assumption in reading your original post was that you didn't understand what I wanted to do (but you did). In order for me to use the solution you have proposed, in addition to working, this behavior would have to

Re: Incrementing a "Private" Integer Space

2007-11-25 Thread David T. Ashley
On 11/25/07, Chris W <[EMAIL PROTECTED]> wrote: > > Stut wrote: > > > > insert into test1 set p = 2, q = (select max(q) + 1 from test1 as tmp > > where p = 2) > > > > Probably not very efficient, but it works. > > > > -Stut > > > Auto increment is much easier to do. If your primary key is made up

Re: Incrementing a "Private" Integer Space

2007-11-25 Thread Chris W
Stut wrote: insert into test1 set p = 2, q = (select max(q) + 1 from test1 as tmp where p = 2) Probably not very efficient, but it works. -Stut Auto increment is much easier to do. If your primary key is made up of two fields and one of them is Auto Increment, then it will have the desir

Re: Incrementing a "Private" Integer Space

2007-11-25 Thread Stut
David T. Ashley wrote: On 11/25/07, Stut <[EMAIL PROTECTED]> wrote: David T. Ashley wrote: I have a table with two integer fields (call them p and q). When I insert a record with a known p, I want to choose q to be one larger than the largest q with that p. What is the best and most effici

Re: Incrementing a "Private" Integer Space

2007-11-25 Thread David T. Ashley
On 11/25/07, Stut <[EMAIL PROTECTED]> wrote: > David T. Ashley wrote: > > I have a table with two integer fields (call them p and q). > > > > When I insert a record with a known p, I want to choose q to be one > larger > > than the largest q with that p. > > > > What is the best and most efficient

Re: Incrementing a "Private" Integer Space

2007-11-25 Thread Stut
David T. Ashley wrote: I have a table with two integer fields (call them p and q). When I insert a record with a known p, I want to choose q to be one larger than the largest q with that p. What is the best and most efficient way to do this? For example, let's say the table contains (p,q): 1,

Re: Incrementing a "Private" Integer Space

2007-11-24 Thread Chris W
David T. Ashley wrote: I have a table with two integer fields (call them p and q). When I insert a record with a known p, I want to choose q to be one larger than the largest q with that p. What is the best and most efficient way to do this? For example, let's say the table contains (p,q):

Incrementing a "Private" Integer Space

2007-11-24 Thread David T. Ashley
I have a table with two integer fields (call them p and q). When I insert a record with a known p, I want to choose q to be one larger than the largest q with that p. What is the best and most efficient way to do this? For example, let's say the table contains (p,q): 1,1 1,2 1,3 2,1 2,2 2,3 2.4