Chris: Mary's answer is pretty good - but I would ask you about the relationships between workshop and users. Is it possible for a user to attend many workshops? Is it possible for a workshop to have many users? If so, you have a many to many relationship and you need a third table to normalize the data.
Anyway you may be able to modify Mary's query with "COUNT (DISTINCT users.user_ID)" to get rid of possible duplicates. Sincerely, Brooks Wilson Try not to become a man of success but rather to become a man of value. - Albert Einstein (1879-1955) Federal Reserve Bank of Atlanta · 1000 Peachtree Street, N.E. · Atlanta Georgia 30309-4470 404.498.8178 · fax 404.498.8239 · [EMAIL PROTECTED] [EMAIL PROTECTED] Sent by: [EMAIL PROTECTED] 01/23/2007 04:05 PM Please respond to discussion@acfug.org To discussion@acfug.org cc Subject Re: [ACFUG Discuss] Join in QofQ Possibly just an OUTER JOIN in the first query? SELECT workshop, COUNT (users.user_ID) AS ct FROM workshops LEFT OUTER JOIN users ON workshops.agencyid = users.user_id GROUP BY workshop_id I think you may be able to put a WITH ROLLUP in there as well, but my SQL book has walked off..... mcg "Chris C. Cooper" <[EMAIL PROTECTED]> Sent by: [EMAIL PROTECTED] 01/23/2007 03:50 PM Please respond to discussion@acfug.org To discussion@acfug.org cc Subject [ACFUG Discuss] Join in QofQ I’ve got 2 tables Workshops users I’m trying to do a count of how many users have signed up for each workshops. I did 2 SQLl statements then I’m trying to put them together with a Query of a Query. I can’t seem to do a join in the QofQ so I how do I list all the workshops when no users have signed up for a particular workshop? Select * FROM workshops,users where workshops.agencyid = users.user_id SELECT count(*) as total, workshop_id from users GROUP by `workshop_id` select * from getWorkshops,getworkshoptotals WHERE getworkshops.workshop_id = getWorkshoptotals.workshop_id Any ideas how I can do this? ------------------------------------- Chris C. Cooper Cooper e.Business Solutions Atlanta, Georgia 404.691.4816 Cooper e.business Solutions – http://www.cooperebusiness.com From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of John Mason Sent: Monday, January 22, 2007 4:34 PM To: discussion@acfug.org Subject: [ACFUG Discuss] SHA-1 cracked These things are always going to happen (just give it enought time), but a research team in China finally cracked SHA-1. http://it.slashdot.org/article.pl?sid=07/01/20/1936257&from=rss John [EMAIL PROTECTED] ------------------------------------------------------------- To unsubscribe from this list, manage your profile @ http://www.acfug.org?fa=login.edituserform For more info, see http://www.acfug.org/mailinglists Archive @ http://www.mail-archive.com/discussion%40acfug.org/ List hosted by FusionLink ------------------------------------------------------------- ------------------------------------------------------------- To unsubscribe from this list, manage your profile @ http://www.acfug.org?fa=login.edituserform For more info, see http://www.acfug.org/mailinglists Archive @ http://www.mail-archive.com/discussion%40acfug.org/ List hosted by FusionLink -------------------------------------------------------------
gifmUuxOcR0KE.gif
Description: GIF image
jpgJPpJYkm2Qj.jpg
Description: JPEG image