Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. problem getting data in a group

problem getting data in a group

Scheduled Pinned Locked Moved Database
databasehelptutorialquestionlearning
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dhyanga
    wrote on last edited by
    #1

    I have a problem getting the right data from the database. I have two tables named "Category" and "Items". Under one category, there can be multiple items. table for category looks like:

    catagory_ID | catagory_Name | catagory_Description

    and the table for item looks like:

    item_ID | cat_ID | item_Name | item_Description

    Here category_ID and item_ID are unique keys and cat_ID is the foreign key which is the category_ID. now i want the query which gives the list of data under typical category in the list format. e.g if Book is the category Name and book_name1,book_name2,book_name3 are the items under category, it should look like

    Book
    book_name1
    book_name2
    book_name3

    how to do that? Well i can get something like this:

    Book book_name1
    Book book_name2
    Book book_name3

    but I want the category just once in the output..what should be the query for that ??

    suchita

    C M C 3 Replies Last reply
    0
    • D Dhyanga

      I have a problem getting the right data from the database. I have two tables named "Category" and "Items". Under one category, there can be multiple items. table for category looks like:

      catagory_ID | catagory_Name | catagory_Description

      and the table for item looks like:

      item_ID | cat_ID | item_Name | item_Description

      Here category_ID and item_ID are unique keys and cat_ID is the foreign key which is the category_ID. now i want the query which gives the list of data under typical category in the list format. e.g if Book is the category Name and book_name1,book_name2,book_name3 are the items under category, it should look like

      Book
      book_name1
      book_name2
      book_name3

      how to do that? Well i can get something like this:

      Book book_name1
      Book book_name2
      Book book_name3

      but I want the category just once in the output..what should be the query for that ??

      suchita

      C Offline
      C Offline
      Corporal Agarn
      wrote on last edited by
      #2

      You will need to use a report builder of some sort. Crystal reports comes to mind, but there are others.

      1 Reply Last reply
      0
      • D Dhyanga

        I have a problem getting the right data from the database. I have two tables named "Category" and "Items". Under one category, there can be multiple items. table for category looks like:

        catagory_ID | catagory_Name | catagory_Description

        and the table for item looks like:

        item_ID | cat_ID | item_Name | item_Description

        Here category_ID and item_ID are unique keys and cat_ID is the foreign key which is the category_ID. now i want the query which gives the list of data under typical category in the list format. e.g if Book is the category Name and book_name1,book_name2,book_name3 are the items under category, it should look like

        Book
        book_name1
        book_name2
        book_name3

        how to do that? Well i can get something like this:

        Book book_name1
        Book book_name2
        Book book_name3

        but I want the category just once in the output..what should be the query for that ??

        suchita

        M Offline
        M Offline
        Mycroft Holmes
        wrote on last edited by
        #3

        SayamiSuchi wrote:

        but I want the category just once in the output..what should be the query for that

        This type of FORMATTING of the data is not done in the database it needs to be done in the presentation layer, as dj suggested.

        Never underestimate the power of human stupidity RAH

        1 Reply Last reply
        0
        • D Dhyanga

          I have a problem getting the right data from the database. I have two tables named "Category" and "Items". Under one category, there can be multiple items. table for category looks like:

          catagory_ID | catagory_Name | catagory_Description

          and the table for item looks like:

          item_ID | cat_ID | item_Name | item_Description

          Here category_ID and item_ID are unique keys and cat_ID is the foreign key which is the category_ID. now i want the query which gives the list of data under typical category in the list format. e.g if Book is the category Name and book_name1,book_name2,book_name3 are the items under category, it should look like

          Book
          book_name1
          book_name2
          book_name3

          how to do that? Well i can get something like this:

          Book book_name1
          Book book_name2
          Book book_name3

          but I want the category just once in the output..what should be the query for that ??

          suchita

          C Offline
          C Offline
          CitrusTech
          wrote on last edited by
          #4

          Take a look at http://dev.mysql.com/tech-resources/articles/hierarchical-data.html, about half-way down the page looks similar to what you're asking.

          Data Quality and Data Profiling software

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups