Forums Get help. Give help.
Inner join vs two select statements
-
Hey peeps!
Not so much a php problem, more of a general SQL performance question.
So i'll have two tables, one with say user information with a unique userID, and another table with all other kinds of meta-data along with which user created it (the userID again).
Now, when i want to display the username of the person (which is in the user-table) based off the userID in the meta-data table:
Would i be better off using an inner join statement fetching the data i need from the users table, or just do it say via a php function that returns me a username based off of a userID (essentially another db-query)?
It's not really gonna be huge amounts of traffic, i'm just sort of wondering what the best approach would be performance-wise anyways.
Cheers for now! -
Yeah that's kind of what i figured as well. It's just that it's kind of easy and handy programmingwise later just having a function for fetching usernames etc, but i think i'll just make a habit out of always fetching usernames etc via Inner Joins in the future on those kind of queries.
Cheers for the reply. :)
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Categories
- All Discussions15,493
- CSS Combat7,193
- Other Discussions3,820
- JavaScript Jungle2,455
- PHP Problems2,025
Tips
Just some helpful hints to get the most out of the forums.
