473,395 Members | 1,696 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Hierarchical Data in Jet

Given: a table which contains a Name or tag field (say for equipment),
FM_TAG_NO and which also has a field referencing FM_TAG_NO, ie
FM_MAJOR_TAG to effect a parent/child relationship.

For example, a piece of equipment:

FM_TAG_NO FM_MAJOR_TAG
UA1001-BLR-01
UA1001-AIR-01 UA1001-BLR-01
UA1001-EXH-01 UA1001-BLR-01

which makes the second two items children of the first, UA1001-BLR-01.

Oracle (and I assume MS SQL) has a nice clause in SQL where you can
retrieve the following, which shows the complete set of children,
grandchildren, great grandchildren, etc (indicated as LEVEL in the
following) - the FM_MAJOR_TAG field is left out here:

FM_TAG_NO LEVEL Item
UA1001-BLR-01 1 Steam Boiler #1
UA1001-AIR-01 2 Air System Components (for UA1001-BLR-01)
UA1001-CTRL-09 3 Damper Control - Forced Draft Fan
UA1001-FAN-01 3 Forced Draft Fan (for UA1001-BLR-01)
UA1001-MTR-26 4 Motor - Forced Draft Fan #1 (for UA1001-BLR-01)
UA1001-WBOX-01 3 Wind Box (for UA1001-BLR-01)
UA1001-EXH-01 2 Exhaust System Components (for UA1001-BLR-01)
UA1001-CTRL-10 3 Damper Control - Outlet (for UA1001-BLR-01)
UA1001-SENR-07 3 Oxygen Sensor (for UA1001-BLR-01)

etc, etc. CTRL-09, FAN-01, WBOX-01 are children of AIR-01 which is the
child of BLR-01, MTR-26 is the child of FAN-01 and so on.

The SQL for this uses the start with/connect by prior clause:

SELECT
FM_TAG_NO,
level,
FM_DESCRIPTION "Item"
from
tma.f_equipment
start with fm_tag_no = 'UA1001-BLR-01'
connect by prior fm_tag_no = fm_major_tag

Does Jet have anything similar?
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Nov 13 '05 #1
4 1617
Neither JET nor MS SQL Server prior to the 2005 release has any direct support
for heirarchical querying. It appears that SQL Server 2005 does have a way to
do it.

On Thu, 27 Jan 2005 11:15:12 -0330, Tim Marshall <TI****@antarctic.flowerpots>
wrote:
Given: a table which contains a Name or tag field (say for equipment),
FM_TAG_NO and which also has a field referencing FM_TAG_NO, ie
FM_MAJOR_TAG to effect a parent/child relationship.

For example, a piece of equipment:

FM_TAG_NO FM_MAJOR_TAG
UA1001-BLR-01
UA1001-AIR-01 UA1001-BLR-01
UA1001-EXH-01 UA1001-BLR-01

which makes the second two items children of the first, UA1001-BLR-01.

Oracle (and I assume MS SQL) has a nice clause in SQL where you can
retrieve the following, which shows the complete set of children,
grandchildren, great grandchildren, etc (indicated as LEVEL in the
following) - the FM_MAJOR_TAG field is left out here:

FM_TAG_NO LEVEL Item
UA1001-BLR-01 1 Steam Boiler #1
UA1001-AIR-01 2 Air System Components (for UA1001-BLR-01)
UA1001-CTRL-09 3 Damper Control - Forced Draft Fan
UA1001-FAN-01 3 Forced Draft Fan (for UA1001-BLR-01)
UA1001-MTR-26 4 Motor - Forced Draft Fan #1 (for UA1001-BLR-01)
UA1001-WBOX-01 3 Wind Box (for UA1001-BLR-01)
UA1001-EXH-01 2 Exhaust System Components (for UA1001-BLR-01)
UA1001-CTRL-10 3 Damper Control - Outlet (for UA1001-BLR-01)
UA1001-SENR-07 3 Oxygen Sensor (for UA1001-BLR-01)

etc, etc. CTRL-09, FAN-01, WBOX-01 are children of AIR-01 which is the
child of BLR-01, MTR-26 is the child of FAN-01 and so on.

The SQL for this uses the start with/connect by prior clause:

SELECT
FM_TAG_NO,
level,
FM_DESCRIPTION "Item"
from
tma.f_equipment
start with fm_tag_no = 'UA1001-BLR-01'
connect by prior fm_tag_no = fm_major_tag

Does Jet have anything similar?


Nov 13 '05 #2

"Tim Marshall" <TI****@antarctic.flowerpots> wrote in message
news:ct**********@coranto.ucs.mun.ca...

<snip>
The SQL for this uses the start with/connect by prior clause:
<snip>
Does Jet have anything similar?
As Steven Jorgensen points out, the answer is no.

The "START WITH . . . . CONNECT BY PRIOR" statement is an ORACLE
propriety feature, and is generally non-portable.
Sincerely,

Chris O.

Tim http://www.ucs.mun.ca/~tmarshal/

Nov 13 '05 #3
Chris2 wrote:
As Steven Jorgensen points out, the answer is no.

The "START WITH . . . . CONNECT BY PRIOR" statement is an ORACLE
propriety feature, and is generally non-portable.


Thanks Steve and Chris.

What a pity, it's an incredibly useful feature.

How do other folks handle hierarchical type reporting, then? VLB code?
Or a complete redesign of how the parent child relationship is set up?
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Nov 13 '05 #4
On Thu, 27 Jan 2005 13:35:41 -0330, Tim Marshall
<TI****@antarctic.flowerpots> wrote:
How do other folks handle hierarchical type reporting, then? VLB code?
Or a complete redesign of how the parent child relationship is set up?
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<


Hi
Take a lookat "Trees in SQL" by Joe Celko
http://www.intelligententerprise.com...equestid=29530
for a radical approach

David
Nov 13 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Daisy | last post by:
Let's say I've got a forum, where users can be moderators of each forum. Tables look like this: USER -------- user_key name FORUM
5
by: clintonG | last post by:
I'm looking for documentation and would not turn my nose up to any code from anybody who thinks they are good at the design of an algorythm that can be used to generated a hierarchical relational...
0
by: stigbn | last post by:
When a DataSet is used as data source for a DataGrid one can get hiearachical datagrid by using relations among the DataTables of the DataSet. (By hierarchical datagrid, I mean columns that can be...
0
by: Björn Bengtsson | last post by:
Hello! I have an urgent problem concerning ASP.NET, ADO.NET, SQL Server, XML and the TreeView control. I have two tables; one describing the products and one describing their relationships. A...
2
by: Don | last post by:
In a previous version of vb I used to save and load hierarchical data from an Access db into a treeview. But, I never found a very satisfying or elegant way to do it. I used a flat file approach...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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
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
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...

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.