Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 2008
»
SQL Server 2008 - General
»
display table in hierarcies
display table in hierarcies
Rate Topic
Display Mode
Topic Options
Author
Message
peleg
peleg
Posted Tuesday, September 11, 2012 3:33 AM
SSC-Enthusiastic
Group: General Forum Members
Last Login: Tuesday, May 07, 2013 12:15 AM
Points: 123,
Visits: 502
i want to display a table in Hierarchie.
the thing is that the table dosen't have parent id or somthing like that.
attached is an example for before and after
10X :)
Post #1357236
Brandie Tarvin
Brandie Tarvin
Posted Tuesday, September 11, 2012 4:20 AM
SSCertifiable
Group: General Forum Members
Last Login: 2 days ago @ 12:39 PM
Points: 6,668,
Visits: 5,695
I can't see your example. Can you post it another way?
Brandie Tarvin, MCITP Database Administrator, MCDBA, MCSA
Webpage
:
http://www.BrandieTarvin.net
LiveJournal Blog
:
http://brandietarvin.livejournal.com/
On
LinkedIn!
,
Google+
, and
Twitter
.
Freelance Writer:
Shadowrun
Latchkeys: Nevermore
,
Latchkeys: The Bootleg War
, and
Latchkeys: Roscoes in the Night
are now available on Nook and Kindle.
Post #1357275
peleg
peleg
Posted Tuesday, September 11, 2012 6:33 AM
SSC-Enthusiastic
Group: General Forum Members
Last Login: Tuesday, May 07, 2013 12:15 AM
Points: 123,
Visits: 502
this is the url to the image
[url=http://s14.postimage.org/my8x11lnz/image.jpg][/url]
Post #1357360
Brandie Tarvin
Brandie Tarvin
Posted Tuesday, September 11, 2012 6:55 AM
SSCertifiable
Group: General Forum Members
Last Login: 2 days ago @ 12:39 PM
Points: 6,668,
Visits: 5,695
The first thing I advise is taking a look at what you actually want mapped. It doesn't make sense to me.
You want app3 stuff mapped to app4?
The second thing I recommend is giving us the DDL for the table, an INSERT statement with sample data, and then post a typed example (rather than an image) of what you want the results of the query to look like (because that's not the same thing as the excel sheet image you posted).
Then we can help you find your best options.
In the meantime, I can recommend that you look into Row_Number() and Common Table Expressions.
Brandie Tarvin, MCITP Database Administrator, MCDBA, MCSA
Webpage
:
http://www.BrandieTarvin.net
LiveJournal Blog
:
http://brandietarvin.livejournal.com/
On
LinkedIn!
,
Google+
, and
Twitter
.
Freelance Writer:
Shadowrun
Latchkeys: Nevermore
,
Latchkeys: The Bootleg War
, and
Latchkeys: Roscoes in the Night
are now available on Nook and Kindle.
Post #1357373
peleg
peleg
Posted Tuesday, September 11, 2012 6:57 AM
SSC-Enthusiastic
Group: General Forum Members
Last Login: Tuesday, May 07, 2013 12:15 AM
Points: 123,
Visits: 502
solved
select CASE WHEN MIN(t.r) = 1 then t.name1
ELSE ''
END as name1,
t.name2, t.name3, sum(t.sum1), sum(t.sum2)
from (select *, ROW_NUMBER() over(partition by name1 order by name1) r
from #tbl1) as t
group by t.name1, t.name2, t.name3
Post #1357375
Brandie Tarvin
Brandie Tarvin
Posted Tuesday, September 11, 2012 7:53 AM
SSCertifiable
Group: General Forum Members
Last Login: 2 days ago @ 12:39 PM
Points: 6,668,
Visits: 5,695
Glad I could help.
Brandie Tarvin, MCITP Database Administrator, MCDBA, MCSA
Webpage
:
http://www.BrandieTarvin.net
LiveJournal Blog
:
http://brandietarvin.livejournal.com/
On
LinkedIn!
,
Google+
, and
Twitter
.
Freelance Writer:
Shadowrun
Latchkeys: Nevermore
,
Latchkeys: The Bootleg War
, and
Latchkeys: Roscoes in the Night
are now available on Nook and Kindle.
Post #1357425
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.