soycharliente Posted August 24, 2007 Share Posted August 24, 2007 I have my db setup like this: users id username password email lastlogin firstname userid firstname lastname userid lastname phone userid phone room userid room im userid screenname type I'm using this query: <?php $query = "SELECT firstname.firstname, lastname.lastname, im.screenname, im.type, room.room, phone.phone FROM users JOIN firstname JOIN lastname JOIN phone JOIN im JOIN room WHERE users.id=firstname.userid AND users.id=lastname.userid AND users.id=phone.userid AND users.id=im.userid AND users.id=room.userid"; ?> My question is, is this query overkill? Can it be cleaned up at all? Is there a faster way to get the same data? Quote Link to comment https://forums.phpfreaks.com/topic/66552-solved-is-this-overkill/ Share on other sites More sharing options...
AndyB Posted August 24, 2007 Share Posted August 24, 2007 Looks like overkill on the tables - most of the data are tightly linked to individual users. Why would you have firstname and lastname in separate tables? Quote Link to comment https://forums.phpfreaks.com/topic/66552-solved-is-this-overkill/#findComment-333345 Share on other sites More sharing options...
soycharliente Posted August 24, 2007 Author Share Posted August 24, 2007 I don't really know. It was just the first thing that came to mind. I guess in retrospect, I should prolly do something like this: info userid firstname lastname room phone im userid screenname type Quote Link to comment https://forums.phpfreaks.com/topic/66552-solved-is-this-overkill/#findComment-333351 Share on other sites More sharing options...
GingerRobot Posted August 24, 2007 Share Posted August 24, 2007 If you're going to be storing all of that information about each user, you might as well stick it all in the same table. I would guess the only possible need for a separate table would be a table listing all of the types of instant messengers - you'd then store an ID of the IM client in the user table. Personally, im not sure id even bother with that. Quote Link to comment https://forums.phpfreaks.com/topic/66552-solved-is-this-overkill/#findComment-333415 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.