473,499 Members | 1,533 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Category sorting problem

107 New Member
Hi, I have a table thats laid out something like the following....
Expand|Select|Wrap|Line Numbers
  1. cat_id, cat_name,    cat_parent
  2.     1   furniture     null
  3.     2   electrical    null
  4.     3   tvs           2
  5.     4   desks         1
  6.     5   corner desks  4       
  7.     6   sony tvs      3
  8.     7   wardrobe      1
so categories are all stored in one table with sub categories. Then I have another table with lots of items that belong to any one of the categories i.e. "my tv" cat_id = 6.

My question is, how can I easily return a list of all items sorted alphabetically by category & subcategory? Is there a away to recurse through the categories just with sql, so it finds the parent category for each item and sorts by that?

I want to keep the category table in this format so it is dynamic and as many sub categories as possible can be added.

Thanks for any help!


Andy.
May 1 '08 #1
2 1387
rpnew
188 New Member
Hi,
I understood your problem a bit not much. can you explain with example what type of output you want exactly??

Regards,
RP
May 5 '08 #2
ronverdonk
4,258 Recognized Expert Specialist
Now do you want a list of all categories (table shown) with all subcategories listed or a list of all subcategories with all categories that each one belongs to?

Ronald
May 5 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
4589
by: Rich Protzel | last post by:
Hello, So my table contains say 100,000 records, and I need to group the categories in fld1 by the highest count of subcategories. Say fld1 contains categories A, B, C, D, E. All of these...
7
3231
by: Federico G. Babelis | last post by:
Hi All: I have this line of code, but the syntax check in VB.NET 2003 and also in VB.NET 2005 Beta 2 shows as unknown: Dim local4 As Byte Fixed(local4 = AddressOf dest(offset)) ...
4
23876
by: Robert Hooker | last post by:
Hi all, I'm looking for a way to sort/order the Category text items in a property grid. The grids sort the categories by alpha when the catergories are displayed. Does anyone at Microsoft (or...
7
1339
by: fiziwig | last post by:
Newbie here. I have a page that uses a <select> list to assign a category to an itme, however it is possible for an item to have more than one category assigned. Right now I have to enter the item...
7
3517
by: Barkster | last post by:
I'm trying to list my categories and how many items are in each category. I'm not much on sub queries. How can I combine these two items. I'd like to display the category and the corresponding...
7
4793
by: Kamal | last post by:
Hello all, I have a very simple html table with collapsible rows and sorting capabilities. The collapsible row is hidden with css rule (display:none). When one clicks in the left of the...
4
1903
by: The Facilitator | last post by:
Well, Outlook seems to be making my life more and more challenging. Categories are added in one field and are delimmited via comma. Have three questions on this one... The first is right now...
1
2164
by: Ahmed Yasser | last post by:
Hi all, i have a problem with the datagridview sorting, the problem is a bit complicated so i hope i can describe in the following steps: 1. i have a datagridview with two columns...
1
3516
by: TomLasky | last post by:
Hi everyone, I'm creating a very powerful web store script in ASP. One of the things I am adding is to allow the user to create their own categories and sub categories for items they wish to sell....
0
7007
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7171
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7220
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6893
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7386
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4599
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3090
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1427
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
664
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.