Gayner Posted September 8, 2009 Share Posted September 8, 2009 SELECT COUNT(p.pid) as tpost, m.id, m.name, m.joined, m.posts, m.desktop FROM ibf_posts p, ibf_members m " am I also calling all my ibf_members table rows? or only the 1's with m. ? Link to comment https://forums.phpfreaks.com/topic/173473-is-this-calling-all-rows-or-just-specified-ones/ Share on other sites More sharing options...
TeNDoLLA Posted September 8, 2009 Share Posted September 8, 2009 You are practically calling "all rows" on both tables, but not all columns. From p table you count all rows for a column pid. Link to comment https://forums.phpfreaks.com/topic/173473-is-this-calling-all-rows-or-just-specified-ones/#findComment-914428 Share on other sites More sharing options...
Gayner Posted September 8, 2009 Author Share Posted September 8, 2009 You are practically calling "all rows" on both tables, but not all columns. From p table you count all rows for a column pid. I dont get? so every row in my ibf_members is being called and the m.id's ? Link to comment https://forums.phpfreaks.com/topic/173473-is-this-calling-all-rows-or-just-specified-ones/#findComment-914454 Share on other sites More sharing options...
Philip Posted September 8, 2009 Share Posted September 8, 2009 You're fetching data from every row, because you have no limiting where clause, thus it calls all the rows. The "COUNT(p.pid) as tpost, m.id, m.name, m.joined, m.posts, m.desktop" are columns (except for COUNT( ), but the p.pid is a column) in your database, not rows. Link to comment https://forums.phpfreaks.com/topic/173473-is-this-calling-all-rows-or-just-specified-ones/#findComment-914460 Share on other sites More sharing options...
Gayner Posted September 8, 2009 Author Share Posted September 8, 2009 You're fetching data from every row, because you have no limiting where clause, thus it calls all the rows. The "COUNT(p.pid) as tpost, m.id, m.name, m.joined, m.posts, m.desktop" are columns (except for COUNT( ), but the p.pid is a column) in your database, not rows. So, thanks for ur reply but is there anyway I dont call everything in ibf_members and just what i need thx? Link to comment https://forums.phpfreaks.com/topic/173473-is-this-calling-all-rows-or-just-specified-ones/#findComment-914478 Share on other sites More sharing options...
Philip Posted September 8, 2009 Share Posted September 8, 2009 Well, what do you need? Link to comment https://forums.phpfreaks.com/topic/173473-is-this-calling-all-rows-or-just-specified-ones/#findComment-914479 Share on other sites More sharing options...
Gayner Posted September 8, 2009 Author Share Posted September 8, 2009 Well, what do you need? Like im calling m.id, m.name, m.joined, m.posts, m.desktop from ibf_members, and I ONLY Want those to be called, i dont want the rest of ibf_members to be called because I have a huge table Link to comment https://forums.phpfreaks.com/topic/173473-is-this-calling-all-rows-or-just-specified-ones/#findComment-914480 Share on other sites More sharing options...
Gayner Posted September 8, 2009 Author Share Posted September 8, 2009 Well, what do you need? Like im calling m.id, m.name, m.joined, m.posts, m.desktop from ibf_members, and I ONLY Want those to be called, i dont want the rest of ibf_members to be called because I have a huge table Bump ? Link to comment https://forums.phpfreaks.com/topic/173473-is-this-calling-all-rows-or-just-specified-ones/#findComment-915077 Share on other sites More sharing options...
Philip Posted September 8, 2009 Share Posted September 8, 2009 I think you may have the terms row and column confused. A row holds is a set of data, based off of what the columns specify the data should look like. You're telling to to return certain columns (not all of them), but since there is no limiting clause (where, joins, etc) it will return the selected columns but for all the rows. Link to comment https://forums.phpfreaks.com/topic/173473-is-this-calling-all-rows-or-just-specified-ones/#findComment-915083 Share on other sites More sharing options...
Gayner Posted September 9, 2009 Author Share Posted September 9, 2009 I think you may have the terms row and column confused. A row holds is a set of data, based off of what the columns specify the data should look like. You're telling to to return certain columns (not all of them), but since there is no limiting clause (where, joins, etc) it will return the selected columns but for all the rows. So t hen I should LIMIT it to like 10 because about 10 m.'s ? Thanks Link to comment https://forums.phpfreaks.com/topic/173473-is-this-calling-all-rows-or-just-specified-ones/#findComment-915133 Share on other sites More sharing options...
Philip Posted September 9, 2009 Share Posted September 9, 2009 LIMIT will limit the number of rows returned. Link to comment https://forums.phpfreaks.com/topic/173473-is-this-calling-all-rows-or-just-specified-ones/#findComment-915143 Share on other sites More sharing options...
Gayner Posted September 9, 2009 Author Share Posted September 9, 2009 LIMIT will limit the number of rows returned. Yea so it wont be calling all of ibf members only 1's i need ? Link to comment https://forums.phpfreaks.com/topic/173473-is-this-calling-all-rows-or-just-specified-ones/#findComment-915178 Share on other sites More sharing options...
Philip Posted September 9, 2009 Share Posted September 9, 2009 It would limit the number of rows returned, not what rows are returned. What exactly are you trying to pull from your db? Link to comment https://forums.phpfreaks.com/topic/173473-is-this-calling-all-rows-or-just-specified-ones/#findComment-915179 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.