473,372 Members | 1,417 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,372 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 988

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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
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
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: 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...

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.