Results 1 to 7 of 7

Thread: relate two tables

  1. #1
    Join Date
    Jul 2003
    Posts
    421

    relate two tables

    hi all I have two tables;
    table student (
    UserId int Not null auto_increment ,
    UniversityN varchar(10) Not null,
    AstComposition varchar(3) Null,
    BstComposition varchar(3) default null,
    ......)
    table ApplyStatus(
    UserId int Not null ,
    UniversityN varchar(10) Not null,
    UserIp varchar(45) Not Null,
    AccessTime varchar(45) Not Null,
    PRIMARY KEY (UserId),
    FOREIGN Key(UserId) REFERENCES student(UserId) on Delete
    Cascade on update cascade)Type=InnoDB DEFAULT CHARSET=utf8;
    I want to use setAutocommit( false) to update this two table on the same time, and I relize I make a mistake , how to get my userId on the second table
    ________
    ACURA CL HISTORY
    Last edited by sql; 03-06-2011 at 02:07 AM.

  2. #2
    Join Date
    Sep 2002
    Location
    Fantasy
    Posts
    4,254
    You updated the second table without userid?

  3. #3
    Join Date
    Jul 2003
    Posts
    421
    Quote Originally Posted by MAK View Post
    You updated the second table without userid?
    No, I want to use the userId from the first table and insert it into second tale
    I use getGenerateKeys() to solve this problem
    ________
    Roll a joint
    Last edited by sql; 03-06-2011 at 02:08 AM.

  4. #4
    Join Date
    Sep 2002
    Location
    Fantasy
    Posts
    4,254

  5. #5
    Join Date
    Jun 2004
    Location
    Atlanta and Manhattan
    Posts
    607

    I'd Be Interested in This, As Well...

    I'd Be Interested in This, As Well... If you could share the solution, others can benefit going forward.

    Thanks.

    Bill

  6. #6
    Join Date
    Jul 2003
    Posts
    421
    I post my solution already , but is in jdbc, and I use mysql
    ________
    California special mustang
    Last edited by sql; 03-06-2011 at 02:09 AM.

  7. #7
    Join Date
    Jun 2004
    Location
    Atlanta and Manhattan
    Posts
    607

    Thanks for the Feedback ...

    ... and for sharing your approach. Feedback like this makes for a "complete solution" that will benefit others who face similar challenges and who are searching for options.

    Again, thanks!

    Bill

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •