MySQL Forums
Forum List  »  Newbie

Re: Pull data from another table
Posted by: Tyler Soden
Date: August 03, 2015 12:27PM

Thanks for the reply! Below are my tables, When a user puts in their Employee ID (timeUserID), information is automatically placed into the other fields related to the first table (useID: timeFirstName, timeMiddleName, timeLastName, timePhoneNumber, timeYearsActive, timeEmailAddress). I know how to do this with a query, but how may I add it intrinsically into the table?

CREATE TABLE `userInfo` (
`userID` int(4) unsigned zerofill NOT NULL AUTO_INCREMENT,
`userState` varchar(13) COLLATE utf8_unicode_ci NOT NULL,
`userEmployeeID` int(6) unsigned zerofill NOT NULL DEFAULT '000000',
`userFirstName` varchar(11) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`userMiddleName` varchar(11) COLLATE utf8_unicode_ci NOT NULL,
`userLastName` varchar(11) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`userPhoneNumber` varchar(15) COLLATE utf8_unicode_ci NOT NULL,
`userYearsActive` varchar(2) COLLATE utf8_unicode_ci NOT NULL DEFAULT '1',
`userEmailAddress` varchar(25) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`userID`)
) ENGINE=InnoDB AUTO_INCREMENT=1111 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `timeLog` (
`timeID` int(4) unsigned zerofill NOT NULL AUTO_INCREMENT,
`timeTimeStamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`timeUserID` int(4) unsigned zerofill NOT NULL,
`timeFirstPunch` varchar(8) NOT NULL,
`timeSecondPunch` varchar(8) NOT NULL,
`timeNotes` text CHARACTER SET utf8 COLLATE utf8_unicode_ci,
`timeFirstName` varchar(11) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`timeMiddleName` varchar(11) COLLATE utf8_unicode_ci NOT NULL,
`timeLastName` varchar(11) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`timePhoneNumber` varchar(15) COLLATE utf8_unicode_ci NOT NULL,
`timeYearsActive` varchar(2) COLLATE utf8_unicode_ci NOT NULL DEFAULT '1',
`timeEmailAddress` varchar(25) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`timeID`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

Options: ReplyQuote


Subject
Written By
Posted
Re: Pull data from another table
August 03, 2015 12:27PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.