Nils,

Thanks. I will code accordingly.

Carlos
> 
> Hi Carlos,
> 
> I believe that would have to be 2 separated steps.
> 
> 1) creating the value in the primary key and 
> 2) creating the foreign key value
> 
> However you can use UNION to write both statements in one go.
> 
> Best regards
> 
> Nils Valentin
> Tokyo/Japan
> 
> 
> 2003年 7月 26日 土曜日 05:20、Write a Friend さんは書きました:
> > I am a newbie to db.
> >
> > I have a few tables, one that I define the primary key.
> >
> > CREATE TABLE member (
> >     memid      INT(6) UNSIGNED ZEROFILL DEFAULT '002000' NOT NULL
> > AUTO_INCREMENT, last       VARCHAR(20)              DEFAULT ''       NOT
> > NULL, first      VARCHAR(20)              DEFAULT ''       NOT NULL, mi    
> >     CHAR(1)                  DEFAULT ''       NOT NULL, PRIMARY KEY(memid),
> >     INDEX name (last,first,mi)) TYPE=INNODB;
> >
> >
> > CREATE TABLE memadv (
> >     memid      INT(6) UNSIGNED ZEROFILL DEFAULT '002000' NOT NULL,
> >     advtype    ENUM('A','T','C')        DEFAULT 'C'      NOT NULL,
> >     FOREIGN KEY (memid) REFERENCES member(memid)
> >         ON UPDATE CASCADE ON DELETE RESTRICT,
> >     INDEX id (memid,advtype)) TYPE=INNODB;
> >
> > What I want is for the primary key to be auto generated and propagated
> > to the other table's memid automatically, when data is entered for
> > the member table? Does that make sense? Am I doint this correctly?
> >
> > Thanks for the help,
> > Carlos
> 
> -- 
> ---
> Valentin Nils
> Internet Technology
> 
>  E-Mail: [EMAIL PROTECTED]
>  URL: http://www.knowd.co.jp
>  Personal URL: http://www.knowd.co.jp/staff/nils
> 


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

Reply via email to