PDA

View Full Version : MyChenQL, part whatever I last used plus 1


filburt1
03-05-2003, 12:58 AM
SELECT s.title, u.styleid, COUNT(u.styleid) FROM style s, user u WHERE s.styleid = u.styleid GROUP BY u.styleid;

...returns:

+-----------+---------+-------+
| title | styleid | total |
+-----------+---------+-------+
| Default | 1 | 616 |
| New Cubed | 7 | 1 |
+-----------+---------+-------+
2 rows in set (0.01 sec)

However there are five style sets (two of which are invisible). No users are using the "Default vB" style set. So how can I get that to show up in this query?

Dean C
03-05-2003, 03:26 PM
Can you stick an OR in a mysql statement?

- miSt

Xenon
03-05-2003, 04:18 PM
depends on where :p

i haven't found a way for that, everyway i tried ends with two queries or doesn't work at all ;)

filburt1
03-05-2003, 04:29 PM
NM, I just copied Chen's. He used joins which I haven't learned yet and I really should.

Xenon
03-05-2003, 04:59 PM
hmm, should have a look into his code, my try with joins didn't work ;)