Click here to Skip to main content
15,899,679 members
Home / Discussions / Database
   

Database

 
GeneralRe: Connecting to SQL 2000 Server from the Internet using public IP Address Pin
Sujay chakraborty28-Jun-09 18:16
Sujay chakraborty28-Jun-09 18:16 
QuestionSQL Issue during database creation Pin
Bahram.Zarrin27-Jun-09 5:42
Bahram.Zarrin27-Jun-09 5:42 
AnswerRe: SQL Issue during database creation Pin
Luc Pattyn27-Jun-09 6:09
sitebuilderLuc Pattyn27-Jun-09 6:09 
AnswerRe: SQL Issue during database creation Pin
Jerry Hammond28-Jun-09 17:19
Jerry Hammond28-Jun-09 17:19 
QuestionWhere the SSIS package saved in SQL2005 Pin
Aman786Singh27-Jun-09 3:39
Aman786Singh27-Jun-09 3:39 
AnswerRe: Where the SSIS package saved in SQL2005 Pin
Niladri_Biswas27-Jun-09 17:13
Niladri_Biswas27-Jun-09 17:13 
QuestionStored procedure help Pin
paypony27-Jun-09 1:34
paypony27-Jun-09 1:34 
AnswerRe: Stored procedure help Pin
Niladri_Biswas27-Jun-09 6:05
Niladri_Biswas27-Jun-09 6:05 
QuestionFetching dependent records from the same table Pin
Neeraj Kr26-Jun-09 7:12
Neeraj Kr26-Jun-09 7:12 
AnswerRe: Fetching dependent records from the same table [modified] Pin
Niladri_Biswas26-Jun-09 15:54
Niladri_Biswas26-Jun-09 15:54 
GeneralRe: Fetching dependent records from the same table Pin
Neeraj Kr26-Jun-09 19:45
Neeraj Kr26-Jun-09 19:45 
AnswerRe: Fetching dependent records from the same table Pin
Mycroft Holmes27-Jun-09 0:37
professionalMycroft Holmes27-Jun-09 0:37 
AnswerRe: Fetching dependent records from the same table Pin
Niladri_Biswas27-Jun-09 16:05
Niladri_Biswas27-Jun-09 16:05 
Sorry for being late in answering your question.
I was completely bogged up with my project.

However, please try this

SELECT F.CATEGORY1,F.CATEGORY2,F.CATEGORY3,F.CATEGORY4 

FROM(

SELECT	C1.TOPCATEGORYID AS CATEGORY1,
		C1.CATEGORYID AS CATEGORY2,
		C2.CATEGORYID AS CATEGORY3,
		C3.CATEGORYID AS CATEGORY4

FROM  CATEGORY AS C1
LEFT OUTER JOIN  CATEGORY AS C2
ON  C2.TOPCATEGORYID = C1.CATEGORYID
LEFT OUTER JOIN  CATEGORY AS C3
ON C3.TOPCATEGORYID = C2.CATEGORYID
WHERE C1.TOPCATEGORYID IS NOT NULL) F 

WHERE F.CATEGORY1  = 1


N.B.~ The inner derived query is the right one. It is showing the right dependencies. Since I had to bring precisely to your format, so I applied the outer query.

However, it will work as per the input you gave and as per your desired output

Let me know in case of any concerns.
Smile | :)

Niladri Biswas

GeneralRe: Fetching dependent records from the same table Pin
Neeraj Kr27-Jun-09 16:42
Neeraj Kr27-Jun-09 16:42 
GeneralRe: Fetching dependent records from the same table [modified] Pin
Niladri_Biswas27-Jun-09 16:59
Niladri_Biswas27-Jun-09 16:59 
QuestionDevelop own small database-system Pin
softwarejaeger26-Jun-09 6:21
softwarejaeger26-Jun-09 6:21 
AnswerRe: Develop own small database-system Pin
Luc Pattyn26-Jun-09 6:55
sitebuilderLuc Pattyn26-Jun-09 6:55 
GeneralRe: Develop own small database-system Pin
softwarejaeger26-Jun-09 7:04
softwarejaeger26-Jun-09 7:04 
GeneralRe: Develop own small database-system Pin
Luc Pattyn26-Jun-09 7:08
sitebuilderLuc Pattyn26-Jun-09 7:08 
GeneralRe: Develop own small database-system Pin
softwarejaeger26-Jun-09 7:14
softwarejaeger26-Jun-09 7:14 
GeneralRe: Develop own small database-system Pin
Luc Pattyn26-Jun-09 7:18
sitebuilderLuc Pattyn26-Jun-09 7:18 
GeneralRe: Develop own small database-system Pin
softwarejaeger26-Jun-09 7:34
softwarejaeger26-Jun-09 7:34 
GeneralRe: Develop own small database-system Pin
David Mujica26-Jun-09 7:21
David Mujica26-Jun-09 7:21 
GeneralWeb Apps only have 1 user Pin
David Mujica26-Jun-09 7:16
David Mujica26-Jun-09 7:16 
GeneralRe: Web Apps only have 1 user Pin
softwarejaeger26-Jun-09 7:27
softwarejaeger26-Jun-09 7:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.