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.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Delete Dashes on multiple select statements
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

mdelgado
Posting Yak Master

USA
141 Posts

Posted - 03/20/2002 :  18:17:07  Show Profile  Reply with Quote
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

USA
3246 Posts

Posted - 03/20/2002 :  18:38:38  Show Profile  Visit AjarnMark's Homepage  Reply with Quote
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

USA
141 Posts

Posted - 03/21/2002 :  11:07:58  Show Profile  Reply with Quote
great!

thanks.

Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2019 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000