Click here to Skip to main content
15,907,328 members
Home / Discussions / Database
   

Database

 
AnswerRe: How to write Pin
gajendra_kshatriya16-Feb-10 21:32
gajendra_kshatriya16-Feb-10 21:32 
AnswerRe: How to write Pin
Mycroft Holmes17-Feb-10 2:14
professionalMycroft Holmes17-Feb-10 2:14 
QuestionHow to Sort this Data Pin
Vimalsoft(Pty) Ltd16-Feb-10 2:32
professionalVimalsoft(Pty) Ltd16-Feb-10 2:32 
AnswerRe: How to Sort this Data Pin
J4amieC16-Feb-10 2:38
J4amieC16-Feb-10 2:38 
GeneralRe: How to Sort this Data Pin
Vimalsoft(Pty) Ltd16-Feb-10 2:45
professionalVimalsoft(Pty) Ltd16-Feb-10 2:45 
AnswerRe: How to Sort this Data Pin
Richard MacCutchan16-Feb-10 2:54
mveRichard MacCutchan16-Feb-10 2:54 
QuestionRe: How to Sort this Data Pin
Chris Meech16-Feb-10 3:07
Chris Meech16-Feb-10 3:07 
AnswerRe: How to Sort this Data Pin
Vimalsoft(Pty) Ltd16-Feb-10 3:25
professionalVimalsoft(Pty) Ltd16-Feb-10 3:25 
let me Explain again. Here is my SQL Query that Produces that table till the end.
The First part that i run is this


Create table [#Nodes]
(id int IDENTITY(0,1),
 NodeID int,
 parent int,
 [Description] varchar(128),
 refParent int
)

INSERT INTO #Nodes
   (NodeID, Parent, [Description])
select distinct n.ID NodeID, n.Parent, nTyp.Descr [Description]
from tbl_node n
inner join tbl_node_type nTyp on nTyp.ID = n.Type and nTyp.Descr in ('Compulsory','One of')
where n.curr = 10 
union
select distinct n.ID NodeID, n.Parent, m.Descr [Description] --, n.Type, n.Curr, m.Descr 
from tbl_node n
inner join tbl_node_type nTyp on nTyp.ID = n.Type and nTyp.Descr = 'Subject'
inner join tbl_modl m on m.id = n.modl
where n.curr =10 



and it Produces the table #Nodes with the Following Records





ID  NODEID	PARENT                DESCRIPTION		REFPARENT
=========================================================================
0	149		NULL      	Compulsory		NULL
1	155		149	        One of			NULL
2	156		149		GunningM		NULL
3	157		155		JonesJ			NULL
4	158		149		One of			NULL
5	159		158		D1127			NULL



and in the next statement i create another temp table

select distinct  nP.id as [id], nP.NodeID, nP.parent, nP.Description, nRef.ID refParent 
into #nodes2 from #Nodes nP
left outer join #Nodes nRef on nP.Parent = nRef.NodeID	-- look up the reference id of the parent
order by  refParent,nP.Description


and the temp table #nodes2 will look like this

ID     NODEID	       PARENT         DESCRIPTION	    REFPARENT
============================================================================
0	149		NULL	       Compulsory	      NULL
2	156		149		GunningM		0
1	155		149		One of			0
4	158		149		One of			0
3	157		155		JonesJ			1
5	159		158		D1127			4


and i made a mistake here by posting a query without a parent Field, to modify that it looks like this

select id as [id2],NodeID,parent,Description,refParent  
 from #nodes2
order by  nodeid,parent, refParent 
Vuyiswa Maseko,

Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.

C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/

AnswerRe: How to Sort this Data Pin
dan!sh 16-Feb-10 6:13
professional dan!sh 16-Feb-10 6:13 
AnswerRe: How to Sort this Data Pin
Jörgen Andersson16-Feb-10 9:06
professionalJörgen Andersson16-Feb-10 9:06 
GeneralRe: How to Sort this Data Pin
Vimalsoft(Pty) Ltd16-Feb-10 19:14
professionalVimalsoft(Pty) Ltd16-Feb-10 19:14 
QuestionHow Pin
JustWorking16-Feb-10 1:57
JustWorking16-Feb-10 1:57 
AnswerRe: How Pin
Jörgen Andersson16-Feb-10 2:21
professionalJörgen Andersson16-Feb-10 2:21 
GeneralRe: How Pin
JustWorking16-Feb-10 19:49
JustWorking16-Feb-10 19:49 
GeneralRe: How Pin
Jörgen Andersson16-Feb-10 21:18
professionalJörgen Andersson16-Feb-10 21:18 
QuestionNot sure if this should be in Linq or Database so forgive me. How would I do a left join in linq to sql in c# Pin
tonyonlinux15-Feb-10 9:12
tonyonlinux15-Feb-10 9:12 
AnswerRe: Not sure if this should be in Linq or Database so forgive me. How would I do a left join in linq to sql in c# Pin
Pranay Rana15-Feb-10 19:22
professionalPranay Rana15-Feb-10 19:22 
Questionsql server express installation Pin
Yulianto.14-Feb-10 22:38
Yulianto.14-Feb-10 22:38 
AnswerRe: sql server express installation Pin
Not Active15-Feb-10 1:38
mentorNot Active15-Feb-10 1:38 
GeneralRe: sql server express installation Pin
εїзεїзεїз16-Feb-10 1:41
εїзεїзεїз16-Feb-10 1:41 
GeneralRe: sql server express installation Pin
Not Active16-Feb-10 6:32
mentorNot Active16-Feb-10 6:32 
GeneralRe: sql server express installation Pin
εїзεїзεїз16-Feb-10 6:58
εїзεїзεїз16-Feb-10 6:58 
GeneralRe: sql server express installation Pin
Not Active16-Feb-10 7:10
mentorNot Active16-Feb-10 7:10 
AnswerRe: sql server express installation Pin
εїзεїзεїз16-Feb-10 1:40
εїзεїзεїз16-Feb-10 1:40 
Questionexercize database schema: need advice Pin
mbrownphysics14-Feb-10 14:04
mbrownphysics14-Feb-10 14:04 

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.