473,396 Members | 1,734 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,396 software developers and data experts.

[Q] complex output result

Hello, I have three tables and would like to see the output result as
below:

--------------------- OUTPUT RESULT
--------------------------------------
index_id officeid officename officecode officedescript
Description attrcatitemid departmentID divisionID branchID
sectionID unitID

6 9 00012 02 NNN Department 133 6 6 6 6 6
3 9 00012 05 CCC Department 133 3 3 3 3 3
5 9 00012 03 AAB Division 134 3 5 5 5 5
9 9 00012 10 jjj Branch 135 3 5 9 9 9
4 9 00012 04 VVV Division 134 3 4 4 4 4
8 9 00012 08 lll Branch 135 3 4 8 8 8
10 9 00012 11 bbn Section 136 3 4 8 10 10
11 9 00012 12 vcc Unit 137 3 4 8 10 11
12 9 00012 13 uuu Section 136 3 4 8 12 12
1 9 00012 09 AAA Department 133 1 1 1 1 1
2 2 00013 01 BBB Department 133 2 2 2 2 2
7 2 00013 07 PPP Division 134 2 7 7 7 7

--------------------- OUTPUT RESULT END
-----------------------------------

table relationship:
A_Office.index_id = organization.officeid
A_Type.index_id = organization.attrcatitemid
organization.index_id = organization.departmentID
organization.index_id = organization.divisionID
organization.index_id = organization.branchID
organization.index_id = organization.sectionID
organization.index_id = organization.unitID

-------------------------------------------------------
Generating tables

A_Office table Script:

if exists (select * from dbo.sysobjects where id =
object_id(N'[dbo].[A_Office]') and OBJECTPROPERTY(id, N'IsUserTable')
= 1)
drop table [dbo].[A_Office]
GO

CREATE TABLE [dbo].[A_Office] (
[index_id] [int] NOT NULL ,
[officename] [nvarchar] (5) COLLATE SQL_Latin1_General_CP1_CI_AS NOT
NULL
) ON [PRIMARY]
GO

INSERT INTO A_Office (
[index_id], [officename])
VALUES (1, '00011')

GO
INSERT INTO A_Office (
[index_id], [officename])
VALUES (2, '00012')

GO
INSERT INTO A_Office (
[index_id], [officename])
VALUES (3, '00014')
GO
INSERT INTO A_Office (
[index_id], [officename])
VALUES (9, '00013')

----------------------------------

A_Type Table:

if exists (select * from dbo.sysobjects where id =
object_id(N'[dbo].[A_Type]') and OBJECTPROPERTY(id, N'IsUserTable') =
1)
drop table [dbo].[A_Type]
GO

CREATE TABLE [dbo].[A_Type] (
[index_id] [int] NOT NULL ,
[description] [nvarchar] (11) COLLATE SQL_Latin1_General_CP1_CI_AS
NOT NULL ,
[sortorder] [int] NOT NULL
) ON [PRIMARY]
GO
INSERT INTO A_Type (
[index_id], [description],[sortorder])
VALUES (133, 'Department', 1)
GO
INSERT INTO A_Type (
[index_id], [description],[sortorder])
VALUES (134, 'Division', 2)
GO
INSERT INTO A_Type (
[index_id], [description],[sortorder])
VALUES (135, 'Branch', 3)
GO
------------------------------------------
organization table script:

if exists (select * from dbo.sysobjects where id =
object_id(N'[dbo].[organization]') and OBJECTPROPERTY(id,
N'IsUserTable') = 1)
drop table [dbo].[organization]
GO

CREATE TABLE [dbo].[organization] (
[index_id] [int] NOT NULL ,
[officeid] [int] NOT NULL ,
[officecode] [nvarchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT
NULL ,
[officedescript] [nvarchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS
NOT NULL ,
[attrcatitemid] [int] NOT NULL ,
[departmentID] [int] NOT NULL ,
[divisionID] [int] NOT NULL ,
[branchID] [int] NOT NULL ,
[sectionID] [int] NOT NULL ,
[unitID] [int] NOT NULL ,
) ON [PRIMARY]
GO

INSERT INTO organization (
[index_id], [officeid],[officecode],[officedescript],[attrcatitemid],[departmentID],[divisionID],[branchID],
[sectionID],[unitID])
VALUES (1, 9, '09', 'AAA', 133, 1, 1, 1, 1, 1)

GO
INSERT INTO organization (
[index_id], [officeid],[officecode],[officedescript],[attrcatitemid],[departmentID],[divisionID],[branchID],
[sectionID],[unitID])
VALUES (2, 2, '01', 'BBB', 133, 2, 2, 2, 2, 2)

GO
INSERT INTO organization (
[index_id], [officeid],[officecode],[officedescript],[attrcatitemid],[departmentID],[divisionID],[branchID],
[sectionID],[unitID])
VALUES (3, 9, '05', 'CCC', 133, 3, 3, 3, 3, 3)

GO
INSERT INTO organization (
[index_id], [officeid],[officecode],[officedescript],[attrcatitemid],[departmentID],[divisionID],[branchID],
[sectionID],[unitID])
VALUES (4, 9, '04', 'VVV', 134, 3, 4, 4, 4, 4)

GO
INSERT INTO organization (
[index_id], [officeid],[officecode],[officedescript],[attrcatitemid],[departmentID],[divisionID],[branchID],
[sectionID],[unitID])
VALUES (5, 9, '03', 'AAB', 134, 3, 5, 5, 5, 5)

GO
INSERT INTO organization (
[index_id], [officeid],[officecode],[officedescript],[attrcatitemid],[departmentID],[divisionID],[branchID],
[sectionID],[unitID])
VALUES (6, 9, '02', 'NNN', 133, 6, 6, 6, 6, 6)

GO
INSERT INTO organization (
[index_id], [officeid],[officecode],[officedescript],[attrcatitemid],[departmentID],[divisionID],[branchID],
[sectionID],[unitID])
VALUES (7, 2, '07', 'PPP', 134, 2, 7, 7, 7, 7)

GO
INSERT INTO organization (
[index_id], [officeid],[officecode],[officedescript],[attrcatitemid],[departmentID],[divisionID],[branchID],
[sectionID],[unitID])
VALUES (8, 9, '08', 'LLL', 135, 3, 4, 8, 8, 8)

GO
INSERT INTO organization (
[index_id], [officeid],[officecode],[officedescript],[attrcatitemid],[departmentID],[divisionID],[branchID],
[sectionID],[unitID])
VALUES (9, 9, '10', 'jjj', 135, 3, 5, 9, 9, 9)

GO
INSERT INTO organization (
[index_id], [officeid],[officecode],[officedescript],[attrcatitemid],[departmentID],[divisionID],[branchID],
[sectionID],[unitID])
VALUES (10, 9, '11', 'bbn', 136, 3, 4, 8, 10, 10)

GO
INSERT INTO organization (
[index_id], [officeid],[officecode],[officedescript],[attrcatitemid],[departmentID],[divisionID],[branchID],
[sectionID],[unitID])
VALUES (11, 9, '12', 'vcc', 137, 3, 4, 8, 10, 11)

GO
INSERT INTO organization (
[index_id], [officeid],[officecode],[officedescript],[attrcatitemid],[departmentID],[divisionID],[branchID],
[sectionID],[unitID])
VALUES (12, 9, '13', 'uuu', 136, 3
Jul 20 '05 #1
0 990

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

Similar topics

3
by: Peter Olsen | last post by:
I want to define a class "point" as a subclass of complex. When I create an instance sample = point(<arglist>) I want "sample" to "be" a complex number, but with its real and imaginary...
0
by: reneecccwest | last post by:
Hello, I have three tables and would like to see the output result as below: --------------------- OUTPUT RESULT -------------------------------------- index_id ...
0
by: reneecccwest | last post by:
Hello, I have three tables and would like to see the output result as below: --------------------- OUTPUT RESULT -------------------------------------- index_id ...
34
by: Pmb | last post by:
I've been working on creating a Complex class for my own learning purpose (learn through doing etc.). I'm once again puzzled about something. I can't figure out how to overload the assignment...
3
by: Arthur | last post by:
Spending the morning avoiding responsibilities, and seeing what it would take to color some complex numbers. class color_complex(complex): def __init__(self,*args,**kws):...
1
by: Najib Abi Fadel | last post by:
Hi i have an ordered table of dates let's say: 1/1/2004 8/1/2004 15/1/2004 29/1/2004 5/2/2004 12/2/2004
3
by: Russ | last post by:
I'd like to get output formatting for my own classes that mimics the built-in output formatting. For example, >>> x = 4.54 >>> print "%4.2f" % x 4.54 In other words, if I substitute a class...
0
by: shaily | last post by:
hi I have a java web service called "Registration service" and C# client which is a consumer of that service java web service running under Tomcat has following interface API exposed ...
25
by: jacob navia | last post by:
The C99 standard forgot to define the printf equivalent for complex numbers Since I am revising the lcc-win implementation of complex numbers I decided to fill this hole with "Z" for...
9
by: Fumeur | last post by:
According to my understanding of the standard, both of _Complex double c1; (1) double _Complex c2; (2) should be...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
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
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
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.