problem getting data in a group
-
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_name3how to do that? Well i can get something like this:
Book book_name1
Book book_name2
Book book_name3but I want the category just once in the output..what should be the query for that ??
suchita
-
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_name3how to do that? Well i can get something like this:
Book book_name1
Book book_name2
Book book_name3but I want the category just once in the output..what should be the query for that ??
suchita
You will need to use a report builder of some sort. Crystal reports comes to mind, but there are others.
-
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_name3how to do that? Well i can get something like this:
Book book_name1
Book book_name2
Book book_name3but I want the category just once in the output..what should be the query for that ??
suchita
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
-
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_name3how to do that? Well i can get something like this:
Book book_name1
Book book_name2
Book book_name3but I want the category just once in the output..what should be the query for that ??
suchita
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