bit_count(bit_or(1<<table1.id)) (Re: [PHP-DB] Howto make a double LEFT JOIN)

From: Date: Sun, 07 Oct 2001 12:34:41 +0000
Subject: bit_count(bit_or(1<<table1.id)) (Re: [PHP-DB] Howto make a double LEFT JOIN)
Groups: php.db 
Request: Send a blank email to php-db+get-13083@lists.php.net to get a copy of this message
Hello, > >> select table1.id,bit_count(bit_or(1<<table1.sid)) as > >> count1,bit_count(bit_or(1<<table3.sid)) as count2,table2.url as url from > >> table1 left join table3 using(id) left join table2 using(id) group by > >> table1.id; > What is the best way to do if id become a sting (a-z-chars)? Oke, this had nothing to do with the problem. bit_count(bit_or(1<<test.id)) gives me some problems as soon as id>64 my table definition: CREATE TABLE test2 ( id int(20) unsigned zerofill NOT NULL auto_increment, ip varchar(15) binary NOT NULL, userid varchar(15) binary NOT NULL, hits tinyint(1) DEFAULT '1' NOT NULL, time int(10) DEFAULT '0' NOT NULL, PRIMARY KEY (id), UNIQUE ip (ip), UNIQUE id (id) ); THE DATA: 1|1|bas|1|1| 2|2|bas|1|2| 3|3|bas|1|3| .. .. 256|256|bas|1|256| now my query: select userid, bit_count(bit_or(1<<test2.id)) as hits FROM test2 GROUP BY userid ORDER BY hits DESC the result: bas|63| the result have to be: bas|256| what going wrong? thanks, Bas

« previous php.db (#13083) next »