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)
 Delete Dashes on multiple select statements

Author  Topic 

mdelgado
Posting Yak Master

141 Posts

Posted - 2002-03-20 : 18:17:07
These are the results of my 2 select statements. The first returns the three ship dates with revenue numbers and the second select statement returns the TOTAL. You'll notice that in between the two select statements I have what appears to be 3 carriage returns. Any way on getting rid of those extra lines and DASHES so that it looks like one continuoUs flow of data?




ShipDate Freight Revenue
----------- --------------------
03/19/2002 $462.70
03/18/2002 $555.49
03/17/2002 $13.49


----------- --------------------
TOTAL $1,031.68


AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2002-03-20 : 18:38:38
How about this:

Create Table #Shipping (
ShipDate smalldatetime NULL,
Freight money NULL
)
GO

SET NOCOUNT ON
INSERT INTO #Shipping (ShipDate, Freight) VALUES ('3/19/02', 462.70)
INSERT INTO #Shipping (ShipDate, Freight) VALUES ('3/18/02', 555.49)
INSERT INTO #Shipping (ShipDate, Freight) VALUES ('3/17/02', 13.49)
SET NOCOUNT OFF
GO

SELECT ShipDate, Sum(Freight) as 'Freight Revenue'
FROM #Shipping
GROUP BY ShipDate WITH ROLLUP

GO

DROP TABLE #Shipping
GO

For more information, lookup ROLLUP in BOL.

------------------------
GENERAL-ly speaking...


Edited by - AjarnMark on 03/20/2002 18:40:24
Go to Top of Page

mdelgado
Posting Yak Master

141 Posts

Posted - 2002-03-21 : 11:07:58
great!

thanks.

Go to Top of Page
   

- Advertisement -