Showing posts with label received. Show all posts
Showing posts with label received. Show all posts

Tuesday, March 27, 2012

filling in missing values

I have a table that keeps track of click statistics for each one of my dealers.. I am creating graphs based on number of clicks that they received in a month, but if they didn't receive any in a certain month then it is left out..I know i have to do some outer join, but having trouble figuring exactly how..here is what i have:

select d.name, right(convert(varchar(25),s.stamp,105),7), isnull(count(1),0)
from tblstats s(nolock)
join tblDealer d(nolock)
on s.dealerid=d.id
where d.id=31
group by right(convert(varchar(25),s.stamp,105),7),d.name
order by 2 desc,3,1

this dealer had no clicks in april so this is what shows up:
joe blow 10-2004 567
joe blow 09-2004 269
joe blow 08-2004 66
joe blow 07-2004 30
joe blow 06-2004 8
joe blow 05-2004 5
joe blow 03-2004 9To have all the dealers needed:

select d.name, right(convert(varchar(25),s.stamp,105),7), isnull(count(1),0)
from tblstats s(nolock)
RIGHT OUTER join tblDealer d(nolock)
on s.dealerid=d.id
where d.id=31
group by right(convert(varchar(25),s.stamp,105),7),d.name
order by 2 desc,3,1

To have all the dates, that is something else ...
SQL Server can only base itself on what it finds in the database ...
If there is notking in tblstats (s) for that moment and you get your months from that table it will not work ...
Create an extra table (or an temp table) that will store all months and create an outer join on that table

Sunday, February 19, 2012

File group space error

Hi,

Received the following error during index creation of the tables. The
data & log files are set to 'unrestricted growth' and enough space
available on the disk. Any reasons?

___________
Microsoft OLE DB Provider for SQL Server (80040e14): Could not allocate
new page for database 'Ultimareports'. There are no more pages available
in filegroup PRIMARY. Space can be created by dropping objects, adding
additional files, or allowing file growth
___________

Thanks
John Jayaseelan

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!John Jayaseelan <john.jayaseelan@.caravan-club.co.uk> wrote in message news:<3fc34206$0$195$75868355@.news.frii.net>...
> Hi,
> Received the following error during index creation of the tables. The
> data & log files are set to 'unrestricted growth' and enough space
> available on the disk. Any reasons?
> ___________
> Microsoft OLE DB Provider for SQL Server (80040e14): Could not allocate
> new page for database 'Ultimareports'. There are no more pages available
> in filegroup PRIMARY. Space can be created by dropping objects, adding
> additional files, or allowing file growth
> ___________
> Thanks
> John Jayaseelan
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!

It's not clear what the issue is without some more information. Do
sp_helpfile and sp_helpfilegroup return what you expect to see? How
big is the database, what is the autogrow increment set to, and what
is the filesystem? Are there any possible external factors, like disk
quotas?

Simon