need to group

Results 1 to 2 of 2

Thread: need to group

  1. #1
    Join Date
    Dec 1969

    Default need to group

    I am trying to group and having alot of trouble. First I tried sql group by, but that wasn&#039;t it. Then I researched and found the DataRelation class but am having major trouble with that. <BR><BR>what I have is a table:<BR>id<BR>category<BR>area_name<BR><BR>sql:< BR>select * from area (basically I just need to group like so...<BR><BR>category<BR> - area1<BR> - area2<BR> - area3<BR><BR>the datarelation is telling me i need two table and create a relation, and i&#039;m lost.<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: need to group

    Are you wanting the areas for a specfic category or all categories?<BR><BR>What is missing is that your query should be something like:<BR>select areas from t_areas_by_category where category=&#039;something&#039;<BR><BR>I am assuming that this is a junction table and that you probably have 2 lookup tables for category and area?<BR><BR>If you want the areas for each unique category, then you need to work with the category lookup table and the area_by_category junction table setting where category is a foreign key in the junction table and primary key in the category table.<BR><BR>Example:<BR>select categories.category, area_by_category.areas <BR>from area_by_category, category<BR>where area_by_category.category=categories.category<BR>< BR>I hope this helps.<BR><BR>JM<BR>where

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts