adrianle Posted February 16, 2016 Share Posted February 16, 2016 I've got a stinker of a question and it's driving me crazy. I have a table showing a list of contacts, and in some cases, more than one Contact work for the same Company (a unique ID is held in this table for the relative Company). I need to somehow return a list of rows showing me all instances of A) the Company ID, and B) the number of contacts for that Company Help?? Quote Link to comment https://forums.phpfreaks.com/topic/300827-selecting-count-and-other-info/ Share on other sites More sharing options...
Solution Barand Posted February 16, 2016 Solution Share Posted February 16, 2016 Don't know what your column names are but something along these lines SELECT id, COUNT(*) as tot FROM tablename GROUP BY id Quote Link to comment https://forums.phpfreaks.com/topic/300827-selecting-count-and-other-info/#findComment-1531191 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.