The relation is that articles can have groups attached to it via the map table. I can insert this and work it out fine. The issue is when I want to pull the groups into a list of checkboxes and check them accordingly upon edit. So, this is what I have as a basis to work on assuming I am polling article #36.
Select *, if(b.articleid=36,1,0) as checked from groups g Left join agmap a on g.groupid=a.groupid Left join articles b on a.articleid=b.articleid Order by g.groupname
This will spit out the groups with all the articles mapped to the groups. What I need is to get back a list of groups with some indicator if there is a match to a particular article id. The results should look something like this:
I tried adding =B3group by groupname=B2 which will give me back the 4 groups which is fine, but the checked column is wrong because it always grabs a lower numbered article id that is matched to the group although the =B3checked=B2 column will be right, in this case 0.
This is a rough example of what it looks like without =B3group by=B2
I know there has to be a way to make it work right but its just not there=8A
Another way of explaining it is, I am trying to get a list of the groups, in order, and get a 1 or 0 in the "checked" column if a specific article is linked to the group (row) or not.
Thanks
Steffan
--------------------------------------------------------------- T E L 6 0 2 . 7 9 3 . 0 0 1 4 | F A X 6 0 2 . 9 7 1 . 1 6 9 4 Steffan A. Cline Steffan@ExecuChoice.net Phoenix, Az http://www.ExecuChoice.net USA AIM : SteffanC Skype : steffancline GOOGLE : Steffan.Cline@gmail.com MSN : steffan@hldns.com YAHOO : Steffan_Cline ICQ : 57234309 ---------------------------------------------------------------
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/mysql?unsub=listsearcharchive@lassosoft.com
Mar 31
S?ndor Hal?sz Re: Select with counts of matching rows from another table...
Mar 31, 2011; 10:53
S?ndor Hal?sz
Re: Select with counts of matching rows from another table...
Mar 31
Reindl Harald Re: Select with counts of matching rows from another table...
Mar 31, 2011; 19:56
Reindl Harald
Re: Select with counts of matching rows from another table...
Search
Lasso Programming
This site manages and broadcasts several email lists pertaining to Lasso Programming and technologies related and used by Lasso developers. Sign up today!