Select values that meet different conditions on different rows

Ok, I got downvoted on this, so I decided to test it: CREATE TABLE userrole ( userid INT, roleid INT, PRIMARY KEY (userid, roleid) ); CREATE INDEX ON userrole (roleid); Run this: <?php ini_set(‘max_execution_time’, 120); // takes over a minute to insert 500k+ records $start = microtime(true); echo “<pre>\n”; mysql_connect(‘localhost’, ‘scratch’, ‘scratch’); if (mysql_error()) { … Read more

How to filter SQL results in a has-many-through relation

I was curious. And as we all know, curiosity has a reputation for killing cats. So, which is the fastest way to skin a cat? The cat-skinning environment for this test: PostgreSQL 9.0 on Debian Squeeze with decent RAM and settings. 6.000 students, 24.000 club memberships (data copied from a similar database with real life … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)