Re: Hierarchic tables in Queries ??
From: Mischa Sandberg (mischa_sandberg_at_telus.net)
Date: 07/13/04
- Next message: Adam Machanic: "Re: get the MAX of each set"
- Previous message: Matias Woloski: "get the MAX of each set"
- In reply to: Claude Vernier: "Hierarchic tables in Queries ??"
- Next in thread: Claude Vernier: "Re: Hierarchic tables in Queries ??"
- Reply: Claude Vernier: "Re: Hierarchic tables in Queries ??"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 13 Jul 2004 19:23:52 GMT
Surprised that Joe Celko hasn't picked up on this thread yet, given the
topic.
I don't think there's anything you could want to know about hierarchies and
trees in SQL
that he hasn't covered already.
"Claude Vernier" <ClaudeVernier@discussions.microsoft.com> wrote in message
news:8ED828FF-C7AF-4150-9ABA-57E8E830319E@microsoft.com...
> Hello,
>
> I'm used since several years to create tables, stored procs and inner
joins...
> So, I can tell that I know SQL syntax a little bit, still I would need
help on this one.
>
> The client gave me a CSV file of subject:
>
> PARENT ID Name_E Name_F
> ------ ----- ------ ------
> 1024 1 Groceries ...
> 1024 2 Tools ...
> 1 3 Meat ...
> 1024 4 Car ...
>
> Where 1024 is the only case where PARENT does not exist as ID.
> I will have to access a list of items and stored them under the right
theme.
>
> For example:
>
> THEME ID Name_E Name_F
> ------ ----- ------ ------
> 3 1 Ham ...
> 2 2 hammer ...
>
> So, I need to know if I should adapt the first table to include the items
> or create another tables.
>
> Most important, I'm looking for a query that would return me
> all the first level THEME (ie: meaning they have 1024 as PARENT) but only
those
> that have an item below at any level.
>
> For example:
> The query would return only Groceries because Meat contains Ham and Tools
> because it has the hammer but not the Car.
>
> I guess that this kind of structure is common in the industry so I could
get some pointers and ideas.
> I would help me a lot.
>
> I'm french canadian living in Paris, so please excuse my english, if i'm
not clear enough,
> don't hesitate to tell me.
>
> Thanks a lot,
> Claude Vernier.
>
- Next message: Adam Machanic: "Re: get the MAX of each set"
- Previous message: Matias Woloski: "get the MAX of each set"
- In reply to: Claude Vernier: "Hierarchic tables in Queries ??"
- Next in thread: Claude Vernier: "Re: Hierarchic tables in Queries ??"
- Reply: Claude Vernier: "Re: Hierarchic tables in Queries ??"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|