I'll admit that I'm a new MSSQL query writer; however, I'm learning.
I'm curious how I could get a GRAND TOTAL to be included directly under
the [Total] column. Any information would be great!
Thank you!
SELECT Sites.Name [Signups Before 4pm], COUNT(Subscribers.Id) [Total]
FROM Subscribers
JOIN Sites on Sites.Id = Subscribers.SiteId
WHERE Subscribers.DateEntered BETWEEN @.beforestart AND @.beforeend AND
DateOptedOut IS NULL
GROUP BY Sites.Name
ORDER BY Sites.NameTry something like this:
SELECT Sites.Name [Signups Before 4pm], COUNT(Subscribers.Id) [Total]
FROM Subscribers
JOIN Sites on Sites.Id = Subscribers.SiteId
WHERE Subscribers.DateEntered BETWEEN @.beforestart AND @.beforeend AND
DateOptedOut IS NULL
GROUP BY Sites.Name
ORDER BY Sites.Name
COMPUTE SUM(COUNT(Subscribers.Id))|||I really appreciate your help with this. However, I get the following
error:
TDS Protocol error: Unsupported TDS token: 0x88
Thanks again!|||You might also check out the WITH ROLLUP option on GROUP BY
"JeffB" wrote:
> Try something like this:
> SELECT Sites.Name [Signups Before 4pm], COUNT(Subscribers.Id) [Total]
> FROM Subscribers
> JOIN Sites on Sites.Id = Subscribers.SiteId
> WHERE Subscribers.DateEntered BETWEEN @.beforestart AND @.beforeend AND
> DateOptedOut IS NULL
> GROUP BY Sites.Name
> ORDER BY Sites.Name
> COMPUTE SUM(COUNT(Subscribers.Id))
>
Showing posts with label curious. Show all posts
Showing posts with label curious. Show all posts
Friday, March 23, 2012
Sunday, February 19, 2012
How to identify a database snapshot?
Hello,
Because you can not backup a database snapshot, I'm curious to as how you identify the database as a snapshot? I need to add an exclusion to my backup scripts so that they don't attempt to backup a snapshot.
Thanks
select source_database_id from sys.databases
if source_database_id is null for a database then it is not a snapshot.
if it is not null, then the database is a snapshot and the source_database_id refers to the database from which the snapshot was created.
Also take a look at http://msdn2.microsoft.com/en-us/library/ms178534.aspx
Subscribe to:
Posts (Atom)