Re: [GENERAL] Query to get the "next available" unique suffix for a name

2010-09-28 Thread Sam Mason
On Mon, Sep 27, 2010 at 06:36:25PM -0700, Mike Christensen wrote: > Thus, the users table already has: > > MikeChristensen1 > MikeChristensen2 > MikeChristensen3 > MikeChristensen4 > > I want to write a SQL query that figures out that MikeChristensen5 is > the next available username and thus sug

Re: [GENERAL] Query to get the "next available" unique suffix for a name

2010-09-28 Thread Mike Christensen
On Tue, Sep 28, 2010 at 12:44 AM, Arjen Nienhuis wrote: >> 4) Do a SELECT on each row that starts with "MikeChristensen" and then >> trying to append the row count to the end, this might not be exact but >> it's somewhat intelligent as a starting point.  However, this might >> require some special

Re: [GENERAL] Query to get the "next available" unique suffix for a name

2010-09-28 Thread Arjen Nienhuis
> 4) Do a SELECT on each row that starts with "MikeChristensen" and then > trying to append the row count to the end, this might not be exact but > it's somewhat intelligent as a starting point.  However, this might > require some special indexes on this table to quickly scan rows that > start with

Re: [GENERAL] Query to get the "next available" unique suffix for a name

2010-09-27 Thread John R Pierce
On 09/27/10 6:36 PM, Mike Christensen wrote: Thus, the users table already has: MikeChristensen1 MikeChristensen2 MikeChristensen3 MikeChristensen4 I want to write a SQL query that figures out that MikeChristensen5 is the next available username and thus suggest it. Here's some things I could

[GENERAL] Query to get the "next available" unique suffix for a name

2010-09-27 Thread Mike Christensen
Hi all - Let's say the user signs up for an account on my site and they need to pick a unique user name. They type in: MikeChristensen However, me and several of my dopplegangers already have accounts. Thus, the users table already has: MikeChristensen1 MikeChristensen2 MikeChristensen3 MikeCh