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? 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] 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! 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
Archived
This topic is now archived and is closed to further replies.