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. ? Quote 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. Quote 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 ? Quote 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. Quote 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? Quote 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? Quote 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 Quote 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 ? Quote 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. Quote 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 Quote 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. Quote 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 ? Quote 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? Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.