Hi,

I'm new at complex SELECT statements, so any help would be appreciated.  I
need to create a summary table of counts from two tables in the database:

year9 has a stack of variables including sex and favsub (favourite subject)
year10 also has a stack of variables including sex and favsub

I'd like to output a table with the following (column %'s if possible,
otherwise counts):

                     sex
favsub       male            female
1             10%              5%
2              ...
...

At the moment, I have this as my MYSQL query:

SELECT favsub, sex, COUNT(favsub) FROM year9 GROUP BY favsub,sex ORDER BY
favsub,sex

* Problems: this is only for one of the tables, and also it's quite messy
formatting it to a nice HTML layout as there are possibly two rows for each
favourite subject, they aren't on the same row.  It's also outputting the
counts, not percentages so I need to do another query to figure out the
total number of males/females.

Again, any help appreciated.

Kind regards
Rachel


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to