Problem with database and different categories (he

Results 1 to 3 of 3

Thread: Problem with database and different categories (he

  1. #1
    Join Date
    Dec 1969

    Default Problem with database and different categories (he

    I have this database with products that looks something like:<BR>---------------<BR>ID &#124 Category &#124 Description &#124 Link<BR> 1 &#124 blah &#124 blah blah &#124 /blah.html<BR> 2 &#124 yada &#124 yada yada &#124 /yada.html<BR> 3 &#124 blah &#124 blah 2 &#124 /blah.html<BR> 4 &#124 yada &#124 yada 2 &#124 /yada.html<BR> 5 &#124 test &#124 test &#124 /test.html<BR> 6 &#124 test &#124 and so on...&#124 /so_on.html<BR>----------------<BR><BR>you get it, a category and a title is the importatant stuff here.. I want this presented like:<BR><BR>BLAH:<BR> blah blah (/blah.html)<BR> blah 2 (/blah.html)<BR>YADA:<BR> yada yada (/yada.html)<BR> yada 2 (/yada.html)<BR>TEST:<BR> test (/test.html)<BR> and so on... (/so_on.html)<BR><BR>How do I do this? I cant figure it out how to code so all titles under the "YADA" header is presented under the YADA header and all the other gets under their respective header.. There is different headers in different tables so I can&#039t use any literals.. Have to be dynamic.. Of course I can list them all but I want them sorted under their respective header..<BR>Is this possible at all? It have to be :)<BR>Its not my DB so please don&#039t suggest changes in the database, this is what I have to play with.. Should I use a separate RS for the headers where I select DISTINCT in some way or what? I just can&#039t figure out how to sort them by header and just write the header ONCE and get the titles under the right header and then same thing with all headers.. there can be a varying number of headers and of course different headers with different amounts of titles under.. <BR><BR>Thanks alot in advance to the ASP-genius who figures this out!<BR><BR>Jonas<BR><BR>PS. I dont want full code, I just want some directions on how to do, maybe some pseude-code and if there&#039s something really hard a code-snippet too.. I don&#039t want you to think I&#039m the Cut&#039n&#039Paste-type-programmer..

  2. #2
    Steve Cimino Guest

    Default RE: Problem with database and different categories

    Use the GROUP BY statement in your query.<BR><BR>SELECT Category, Description<BR>FROM MyTable<BR>WHERE Description = &#039yada&#039<BR>GROUP BY Category, Description<BR>ORDER BY Category<BR><BR>You can&#039t use a SELECT * when using the GROUP BY clause.

  3. #3
    Join Date
    Dec 1969

    Default RE: Problem with database and different categories

    &nbsp;<BR>I recently did one exactly the way you are expecting.This is how it looks.If you are interested i can send u the code, coz i cann&#039t explain all the variables etc., but if you look this format and the code i think it is easy for you to understand, and even if you look at it once, i don&#039t think unless you have some of your imagination you can implement it.tell me if you want, after looking at this output.<BR>..................................<BR>< BR> A<BR> AFRICA<BR><BR> The African Salad Shared by Meg Asouza<BR> African Tomato-Avocado-Buttermilk Soup Shared by Jennelle James<BR> Porkless Mixed Greens Shared by Michelle Richardson<BR><BR> C<BR><BR> CANADA<BR><BR> Naniamo Bars Shared by Anne Hitchman,Market Risk<BR><BR> M<BR><BR> MEXICO<BR><BR> Peanut Soup with Okra Croutons Shared by Jennelle James<BR>-----------------------------------------------------------------<BR><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