I have this table
Code:
+--------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------+-------------+------+-----+---------+----------------+
| id | smallint(4) | | PRI | NULL | auto_increment |
| type | varchar(20) | | | | |
| title | varchar(70) | | | | |
| method | text | | | | |
| switch | tinyint(1) | YES | | 0 | |
+--------+-------------+------+-----+---------+----------------+
and I want to select all the individual types and the number of records with that type where switch = 1. Sample rows could be this
Code:
1 MyCat Script More text 1
2 OtherCat Whois Content 1
3 MyCat DNS Doobie 1
4 OtherCat Section 508 Guidelines 0
and from that I want
Now I've done enough asking other people to do my work for me
I've had a few shots myself but they returned huge numbers which were obviously incorrect.
Code:
select distinct
g.type
, count(g2.*) as num
from
games as g
, games as g2
where
g2.switch = 1
and g.type = g2.type
Yeah, so obviously I'm not too good at harder kins of queries 
Thanks for any help
Bookmarks