TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Deepak Ratan
NA
175
50.3k
How to write a query
Jun 12 2015 6:02 AM
This is my table, for this table how to write a
ParentChild hierarchy in SQL
Table :
Create table Emp(
ID int
,
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
->
Child
NatIDNumber int,
LoginID varchar(50),
OrgLevel int
,
-
-
-
-
-
-
-
-
-
-
-
-
-
>
Parent
JTitle varchar(50),
DOB date
Gender nchar(1)
)
ID
NatIDnumber
LoginID
OrgLevel
JTitle
DOB
Gender
1
2958472
xxxx1
0
Chief
1963-03-02
M
2
2457979
xxxx2
1
Vice President
1965-09-01
F
3
5096471
xxxx3
2
Engineering
1968-12-13
M
4
1124578
xxxx4
3
Senior Tool
1969-01-23
M
5
6952569
xxxx5
3
Design Eng
1946-10-29
F
6
9983206
xxxx6
3
Design Eng
1953-04-11
M
7
1349691
xxxx7
3
Research
1981-03-27
M
Reply
Answers (
5
)
database
Copy tables from one database to another in SQL Server