RE: Incrementing using Max(Field) ?

2006-08-15 Thread William DeMasi
Thank you very much!

-Original Message-
From: Visolve DB TEAM [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, August 15, 2006 12:44 PM
To: [EMAIL PROTECTED]; mysql@lists.mysql.com
Subject: Re: Incrementing using Max(Field) ?

Hello William

Try the below Query to insert next maximum value of  the field into same 
table

INSERT  INTO  Sample(id)  SELECT MAX(id)+1 FROM  Sample

Thanks
Visolve DB Team



- Original Message - 
From: William DeMasi [EMAIL PROTECTED]
To: mysql@lists.mysql.com
Sent: Tuesday, August 15, 2006 12:34 AM
Subject: Incrementing using Max(Field) ?


 Does anyone have any ideas of how I can select the max value and insert 
 the
 next highest value?

 I want something that would do something like this:

 Insert into table1 (select max(field1)+1 from table1);

 This obviously doesn't work.

 I know if the table was set to auto-increment it wouldn't be an issue, but

 I
 am not able to change its schema.

 Thank you.

 - William


 -- 
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe: 
 http://lists.mysql.com/[EMAIL PROTECTED]

 


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Incrementing using Max(Field) ?

2006-08-14 Thread William DeMasi
Does anyone have any ideas of how I can select the max value and insert the
next highest value?

I want something that would do something like this:

Insert into table1 (select max(field1)+1 from table1);

This obviously doesn't work.

I know if the table was set to auto-increment it wouldn't be an issue, but I
am not able to change its schema.

Thank you.

- William


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Trouble with using IN for a sub-query statement

2006-08-07 Thread William DeMasi
The select statement I am trying to run is:
select * from c2iedm_dev2.act where act_id =(select obj_act_id from
c2iedm_dev2.act_functl_assoc where subj_act_id =24);

But I get the error below:
You have an error in your SQL syntax.  Check the manual that corresponds to
your MySQL server version for the right syntax to use near 'select
obj_act_id from c2iedm_dev2.act_functl_assoc where subj_

I have looked at the documentation for MySQL and this seems to be the
correct syntax for using IN.

Could someone please let me know what is wrong?

Thank you.

William DeMasi



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]