jeudi 31 mars 2016

Weird use case with SQL

I need "@bb" to equal the COUNT in that first subquery but "a" isn't recognized in the first subquery only the second? I've tried a lot of things with INNER JOIN and scopes but can't get anything to work. I don't use advanced SQL that much.

SELECT name,id AS a,buyin,smallblind,@bb=(SELECT COUNT(players.tbl) FROM players WHERE players.tbl=a) FROM tables WHERE tables.active>300 AND (SELECT COUNT(players.tbl) FROM players WHERE players.tbl=a)<8;

I searched a while and didn't see a solution to this specific problem. I also tried some hours with trial and error in sqllite.

Aucun commentaire:

Enregistrer un commentaire