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
 General SQL Server Forums
 New to SQL Server Programming
 Please help !

Author  Topic 

kom_s
Starting Member

2 Posts

Posted - 2008-02-21 : 06:54:07
Hello all.
People I have a little problem and need your help.
I have a query which give me result like this table

ID |AAA|BBB
-----------
97|318|75
-----------
97|319|76
-----------
97|320|77
-----------
157|342|100
-----------
157|343|101
-----------
157|344|102
-----------
157|345|103
-----------
157|346|104
-----------
157|347|105
-----------
158|348|106
-----------
158|349|107
-----------
160|350|108
-----------
160|351|109
-----------
160|352|110
-----------
160|353|111
-----------
160|354|112
-----------

What SQL code I need to have result in this view:


ID AAA BBB
97 |318|75
|319|76
|320|77
------------
157 |342|100
|343|101
|344|102
|345|103
|346|104
|347|105
------------
158 |348|106
|349|107
------------
160 |350|108
|351|109
|352|110
|353|111
------------


Regards, KomS

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2008-02-21 : 07:03:25
This is purely formatting issue. Why don't you handle it in the front-end ?

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-02-21 : 07:30:13
If you use reports, make use of it's Suppress if duplicated feature

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

kom_s
Starting Member

2 Posts

Posted - 2008-02-21 : 07:52:44
Dear all,
I'm very new in SQL.
I just make query in MS access.
I'm reading this query by ASP
and now have result table like this.
------------------------------------------------
<table border="1" id="table1">
<tr>
<td>ID</td>
<td>AAA</td>
<td>BBB</td>
</tr>
<tr>
<td>97</td>
<td>318</td>
<td>75</td>
</tr>
<tr>
<td>97</td>
<td>319</td>
<td>76</td>
</tr>
<tr>
<td>97</td>
<td>320</td>
<td>77</td>
</tr>
<tr>
<td>157</td>
<td>342</td>
<td>100</td>
</tr>
<tr>
<td>157</td>
<td>343</td>
<td>101</td>
</tr>
<tr>
<td>157</td>
<td>344</td>
<td>102</td>
</tr>
<tr>
<td>157</td>
<td>345</td>
<td>103</td>
</tr>
<tr>
<td>157</td>
<td>346</td>
<td>104</td>
</tr>
<tr>
<td>157</td>
<td>347</td>
<td>105</td>
</tr>
<tr>
<td>158</td>
<td>348</td>
<td>106</td>
</tr>
<tr>
<td>158</td>
<td>349</td>
<td>107</td>
</tr>
<tr>
<td>160</td>
<td>350</td>
<td>108</td>
</tr>
<tr>
<td>160</td>
<td>351</td>
<td>109</td>
</tr>
<tr>
<td>160</td>
<td>352</td>
<td>110</td>
</tr>
<tr>
<td>160</td>
<td>353</td>
<td>111</td>
</tr>
<tr>
<td>160</td>
<td>354</td>
<td>112</td>
</tr>
</table>
---------------------------------------------------------------
Now I want to rebuild it like this view.
Thank you.

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\<table border="1" width="162" height="19" id="table2">
<tr>
<td>ID</td>
<td>AAA</td>
<td>BBB</td>
</tr>
<tr>
<td rowspan="3">97</td>
<td>318</td>
<td>75</td>
</tr>
<tr>
<td>319</td>
<td>76</td>
</tr>
<tr>
<td>320</td>
<td>77</td>
</tr>
<tr>
<td rowspan="6">157</td>
<td>342</td>
<td>100</td>
</tr>
<tr>
<td>343</td>
<td>101</td>
</tr>
<tr>
<td>344</td>
<td>102</td>
</tr>
<tr>
<td>345</td>
<td>103</td>
</tr>
<tr>
<td>346</td>
<td>104</td>
</tr>
<tr>
<td>347</td>
<td>105</td>
</tr>
<tr>
<td rowspan="2">158</td>
<td>348</td>
<td>106</td>
</tr>
<tr>
<td>349</td>
<td>107</td>
</tr>
<tr>
<td rowspan="5">160</td>
<td>350</td>
<td>108</td>
</tr>
<tr>
<td>351</td>
<td>109</td>
</tr>
<tr>
<td>352</td>
<td>110</td>
</tr>
<tr>
<td>353</td>
<td>111</td>
</tr>
<tr>
<td>354</td>
<td>112</td>
</tr>
</table>
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
Regards, KomS
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-02-21 : 07:56:31
Read my first reply in this page and see if you can simulate Suppress if duplicated point
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=76862&whichpage=2

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

sakets_2000
Master Smack Fu Yak Hacker

1472 Posts

Posted - 2008-02-21 : 08:34:22
Has this got something to do with essbase ??
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-02-21 : 08:41:14
quote:
Originally posted by sakets_2000

Has this got something to do with essbase ??


What do you mean?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

sakets_2000
Master Smack Fu Yak Hacker

1472 Posts

Posted - 2008-02-21 : 08:46:46
The format thats being asked for is an essbase export format.Its possible that it could be in reference with that,In which case there are better ways of doing it.Essbase by the way is a product of Hyperion-Oracle,a multi dimensional database.
Go to Top of Page
   

- Advertisement -