> -----Original Message----- > From: Paul DuBois [mailto:[EMAIL PROTECTED]] > Sent: Saturday, December 28, 2002 6:44 PM > To: Gloria L. McMillan; [EMAIL PROTECTED] > Subject: Re: SELECT query > > > At 14:38 -0700 12/28/02, Gloria L. McMillan wrote: > >RE: MySQL SELECT and COUNT or SUM > > > >> > > > Hi, all! > >> > >> I think this SELECT command does almost what I need. > >> > >> SELECT CW03survey.Q6, CW03survey.Q7, CW03survey.Q8 > >> > >> FROM CW03survey > >> > >> WHERE CW03survey.Q3 = '1' > >> > >> ============================================= > >> > >> But how can I get it to also run a count of the total of each > >> column? Q6, Q7...?
Try: SELECT CW03survey.Q6, CW03survey.Q7, CW03survey.Q8 FROM CW03survey WHERE CW03survey.Q3 = '1' UNION SELECT SUM(CW03survey.Q6), SUM(CW03survey.Q7), SUM(CW03survey.Q8) FROM CW03survey WHERE CW03survey.Q3 = '1' --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php