Unique Categories ..

Results 1 to 3 of 3

Thread: Unique Categories ..

  1. #1
    Join Date
    Dec 1969

    Default Unique Categories ..

    I&#039;ve FAQ table which stores FAQ title, description & category fields. Its Access table. Categroy field can have value - which specifies if FAQ is related to any specific subject. Foreg: Heart Disease, Diabetes, etc... It can be blank. There is no category table as these categories can be different many times..<BR><BR>My quesiton is if I want to display FAQ sorted with category can this be done? or do I&#039;ve to use category table?<BR><BR>What I&#039;m thinking is can I display FAQ using "Unique" SQL for category field? then all FAQ&#039;s applied to that category. Then display other category & FAQ applied to that category..<BR><BR>Thanks in advance

  2. #2
    Join Date
    Dec 1969

    Default RE: Unique Categories ..

    ..so you&#039;re categories are listed with every FAQ item as a field?<BR>ie: <BR>Table faq<BR>id title description, category<BR><BR>if so, that&#039;s not very efficient. You&#039;re right in assuming that it&#039;s better to have a separate table for the category field. But, it can be done with the way you have arranged things. in your SELECT statement, just use a GROUP BY option, then ORDER BY category. That should fix things up for you.<BR>"SELECT Title,Category from FAQS WHERE blah = blah GROUP BY Category,Title ORDER BY Category"<BR>???not tested, but that&#039;s the general idea.<BR>~~Chaotix

  3. #3
    Join Date
    Dec 1969

    Default Easy...

    SELECT DISTINCT Category FROM table ORDER BY Category<BR><BR>But be careful: "Heart Disease" and "Heart Diseases" won&#039;t be the same! ("s" on end of second one)<BR><BR>

Posting Permissions

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