On 4 Jan 2004, at 15:09, Mike Mapsnac wrote:


I have table with 7 fields. First field is id (auto increment). As I understand the value should start from 0 and next value will auto increment.

And I shouldn't add insert the value. So the insert
statemens below gives me an error. ERROR 1136:Column count doesn't match value count at row 1


insert into product values('456789','t1', 'new', 2, 2, 10);

Two options:


Use NULL as the value for the auto-increment column. (Probably the easiest method!)
(side note: you can then retrieve the real value with LAST_INSERT_ID() function)


Or, specify the column names in your query as well, so MySQL can tie up columns and values:

insert into product (col2, col3, col4, col5, col6) values('456789','t1', 'new', 2, 2, 10)

Without column names, it expects there to be values for all columns. So in your case, just don't specify the auto-increment column.


HTH Steve.


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



Reply via email to