dch27 Posted June 12, 2008 Share Posted June 12, 2008 my web host is running MYSQL 3.23, 4.0, 4.1. I don't know which. (godaddy) They have a web gui that lets u create tables. It also has an sql query window. I have two tables. members & users. users has everybody that signs up for the sight, members are users that are affiliated. I need a field in members to be called 'userID' and it needs to reference 'users'. how? create table members ( userID not null references users ) does not work. can i use triggers? if so, how? Quote Link to comment Share on other sites More sharing options...
fenway Posted June 12, 2008 Share Posted June 12, 2008 First, find out which version you're running. Quote Link to comment Share on other sites More sharing options...
dch27 Posted June 12, 2008 Author Share Posted June 12, 2008 4.1 Quote Link to comment Share on other sites More sharing options...
fenway Posted June 13, 2008 Share Posted June 13, 2008 OK... now what do you mean by "doesn't work"... generates an error, doesn't act the way you expect, etc.? I see no ON UPDATE / ON DELETE... Quote Link to comment Share on other sites More sharing options...
dch27 Posted June 13, 2008 Author Share Posted June 13, 2008 What I mean by doesn't work: create table member ( memberID integer primary key, userName not null references users, ); #1064 - 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 'not null references users, )' at line 3 I want the userName to be pulled out of the users table. Quote Link to comment Share on other sites More sharing options...
fenway Posted June 13, 2008 Share Posted June 13, 2008 Maybe because you're missing the column type?!?!? Quote Link to comment Share on other sites More sharing options...
dch27 Posted June 13, 2008 Author Share Posted June 13, 2008 yea i think that was it. working now. forgive me Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.