Jump to content


Photo

I know someone can help me with this


  • Please log in to reply
1 reply to this topic

#1 ShoelessJoe

ShoelessJoe
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 26 April 2003 - 07:34 AM

BACKGROUND

Ive got a list of checkboxes. Each one is a unique keyword. There can be multiple keywords per Subroup but a keyword can only be associated with one subgroup.

Subgroup A
Keyword A
Keyword B
Keyword C

Subgroup B
Keyword D
Keyword E
Keyword F

Subgroup C
Keyword G
Keyword H
Keyword I

etc... Each Subgroup is associated with several Groups

Group A
Subgroup A
Subgroup E

Group B
Subgroup A
Subgroup B

Group C
Subgroup B
Subgroup E

So, in other words, keyword A would be associated with Group A and Group B via Subgroup A. Keyword E, on the other hand, which is associated with Subgroup B would also be associated with Group B but also associated with Group C

A person may select A, B, or A and B (as well as any or all of the keywords but I\'m limiting this example to keep it simple). Therefore their choice. depending upon which keyword(s) selected could be associated with Group A and B, or Group B and C, or A, B, and C.

In most, one would select keywords only under a single Subgroup but they are not limited to soing so.

Upon selecting keywords and clicking on submit, I want to bring up a page with a list of only those Groups associated with the selected keywords (I need to limit the number of groups because, while there are perhaps 75 keywords and fewer than 10 subgroups, there are thousands of Groups. The Groups will have check boxes and will be in columns.

In other words, after all is said and done, someone will have chosen a list of keywords and a list of groups. The subgroup selected are implicit since a keyword can must be associated with a single subgroup.

Here are my tables and relevant fields:

keywords: k.keywordid, k.name, k.subgroupid

group: g.subgroupid, g.name


MY MySQL PROBLEM IS THIS:

I need to pass the list of all keywords selected on to the second page and then again on to a third. I know I want to select g.name from group from each row where g.subgroupid equals k.subgroupid.

Since they will typically select several keywords under a given subgroup, this means that I will be pulling up the same subgroup, and by relationship, group, several times.

So I want to eliminate duplicates before printing and then passing on names to the next page.

Of course I will be passing both a list of keywords selected and Groups selected along to the next page whereupon additional information will be collected and everthing thereafter stored into the appropriate tables.[/b]

#2 effigy

effigy
  • Staff Alumni
  • Advanced Member
  • 3,600 posts
  • LocationIL

Posted 29 April 2003 - 05:08 AM

wow. :shock: it\'s 1am... short response: can you use DISTINCT?
Regexp | Unicode Article | Letter Database
/\A(e)?((1)?ff(?:(?:ig)?y)?|f(?:ig)?)\z/




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users