From: Reindl Harald Date: March 31 2011 5:56pm Subject: Re: Select with counts of matching rows from another table... List-Archive: http://lists.mysql.com/mysql/224739 Message-Id: <4D94C05A.3020909@thelounge.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig6C555A74DAD81EC989EB93A3" --------------enig6C555A74DAD81EC989EB93A3 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Am 31.03.2011 17:53, schrieb S?ndor Hal?sz: >>>>> 2011/03/23 16:29 -0700, Steffan A. Cline >>>> > So, this is what I have as a basis to work on assuming I am polling > article #36. > =20 > Select *, if(b.articleid=3D36,1,0) as checked from groups g > Left join agmap a on g.groupid=3Da.groupid > Left join articles b on a.articleid=3Db.articleid > Order by g.groupname > <<<<<<<< > Why not restrict it to '36': 'WHERE b.articleid =3D 36'? >=20 > As for the grouping, as it says in its helptext about MySQL s permissiv= e 'GROUP BY',=20 > the choice for any thus allowed field --one forbidden by the standard--= is random.=20 > (It happens I have a case where that is just what I want: I do not care= which value=20 > is shown, as long as it goes with the rest.) Maybe you want 'articleid'= , too, in the grouping? instead of writing me since weeks private mails that you do not want gpg-signed mails and how hard it is for you to not ignore .asc-attachment= s you should learn to use your mail-client and how to quote answers original-text followed by <<<<<<<< is NOT quoting! --------------enig6C555A74DAD81EC989EB93A3 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iEYEARECAAYFAk2UwFoACgkQhmBjz394Ann7ggCdFzDnfYUHafSbKOTs9/yVvRYG cr0AoINWc2ByQjPX3IZ7O+sZ87Sk35OI =IFkO -----END PGP SIGNATURE----- --------------enig6C555A74DAD81EC989EB93A3--