lead2gold Posted July 19, 2006 Share Posted July 19, 2006 Ok, i guess my brain isn't working...What am i doing wrong?[code]SELECT count( gid )FROM tableWHERE sid =1GROUP BY gid[/code]the above returns 2.I currently have 2 entries in the entire database (to make testing easy).What i want to have returned is 1 because both entries have the same gid.How do i manipulate the above to acomplish this? Quote Link to comment https://forums.phpfreaks.com/topic/15062-simple-count-query-just-cant-do-it/ Share on other sites More sharing options...
shoz Posted July 19, 2006 Share Posted July 19, 2006 [code]SELECTCOUNT(DISTINCT gid) AS numFROMtablenameWHEREsid = 1[/code] Quote Link to comment https://forums.phpfreaks.com/topic/15062-simple-count-query-just-cant-do-it/#findComment-60577 Share on other sites More sharing options...
lead2gold Posted July 19, 2006 Author Share Posted July 19, 2006 I'll give some grace for that!Thanks a million! Quote Link to comment https://forums.phpfreaks.com/topic/15062-simple-count-query-just-cant-do-it/#findComment-60578 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.