Hello list,

I have a table that I want to insert records based on a criteria select.

The database colums are...
________________________________________
     |           |      |        |
code + contactno + note + source + date
_____|___________|______|________|______


my SQL statement is

INSERT INTO contactnotes (contactno, note, source, date)
        SELECT code, 'show catalog sent to user' , 'catalogs' , '20000214'
        FROM catalogs
        WHERE country = 'US' AND show_qty = '1' AND completed != '1'

As you can see I'm not using INSERT INTO contactnotes (code, contactno, note
...)

I want code to AUTO_INCREMENT but it won't because the select statement
does't have a default value to insert into the column.

My question is if I use....


INSERT INTO contactnotes (code, contactno, note, source, date)
        SELECT 'XXXX', code, 'show catalog sent to user' , 'catalogs' , '20000214'
        FROM catalogs
        WHERE country = 'US' AND show_qty = '1' AND completed != '1'


What value should XXXX in the SELECT statement be so that I would
AUTO_INCREMENT automatically. Or if their is another way.

Thanks N'Adv.

J. Scott Andreas :)
IS/Programmer/WebDevelopement
Learning Services, Inc.
e-mail: [EMAIL PROTECTED]
phone: 1-800-877-9378 ext. 146
fax: (541) 744-2056
       ---    __o
     ---   _-\<,_
      --- (_)/ (_)



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to