Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 I want sequence in my query

Author  Topic 

under2811
Constraint Violating Yak Guru

366 Posts

Posted - 2006-09-11 : 07:50:30
hi all
I am inserting records from front end into my DB sql server and then i prepare report for it like below

Title BelongTo Desc ID belongToID
Doc Null AllDoc 1 Null
Word 0 All Word 2 1
Excel 0 All Excel 3 1
Newsletter Null All News 4 Null
Daily News 0 Daily 5 4
Weekly News 0 Weekly 6 4

Now if i insert one new records for Doc i.e. PowerPoint under Doc it will placed below Weekly News.
But i want that below Excel title...

Title BelongTo Desc ID belongToID
Doc Null AllDoc 1 Null
Word 0 All Word 2 1
Excel 0 All Excel 3 1
PowerPoint 0 PowerPoint 7 1
Newsletter Null All News 4 Null
Daily News 0 Daily 5 4
Weekly News 0 Weekly 6 4

what is my select query???
select title,BelongTo,Desc,ID,BelongToID
from Information
order by????????

chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2006-09-11 : 08:06:54
Its not possible to insert the records between a particular records..

Is it Possible to have a column called Orderby and while inserting the records, insert the particular integer value ?

and then while selecting order by that "Orders" columns....

Chirag
Go to Top of Page

under2811
Constraint Violating Yak Guru

366 Posts

Posted - 2006-09-12 : 00:45:28
HI ALL,

SELECT rid,nme,pwd,Main,nmd FROM EMPP

rid nme pwd Main nmd
1 D P NULL NULL
2 f p 1 NULL
3 v p 1 NULL
4 n m NULL NULL
5 L N 4 NULL
6 P L 4 NULL
7 K J 1 NULL

I WANT THIS LIKE

rid nme pwd Main nmd
1 D P NULL NULL
2 f p 1 NULL
3 v p 1 NULL
7 K J 1 NULL
4 n m NULL NULL
5 L N 4 NULL
6 P L 4 NULL


PLEASE HELP ME OUT

T.I.A

Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-09-12 : 00:53:24
what is the required ordering sequence ?


KH

Go to Top of Page

under2811
Constraint Violating Yak Guru

366 Posts

Posted - 2006-09-12 : 01:06:51
i want root level and then leaf level always

like under column rid and main

rid-------main
1---------NULL
2---------1
3---------1
7---------1
4---------NULL
5---------4
6---------4

T.I.A
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-09-12 : 01:43:24
I assume root level is main and leaf level is rid ?
then why the ordering is not like this ?

rid-------main
1---------NULL
4---------NULL
2---------1
3---------1
7---------1
5---------4
6---------4



KH

Go to Top of Page
   

- Advertisement -