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.
| Author |
Topic |
|
dustinkovich
Starting Member
1 Post |
Posted - 2009-07-03 : 13:47:34
|
| Hi,Can someone please help me.I have a table definition asUSE [Reports]GO/****** Object: Table [dbo].[Temp] Script Date: 07/03/2009 13:43:03 ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOCREATE TABLE [dbo].[Temp]( [id] [int] IDENTITY(1,1) NOT NULL, [AdGroup] [nvarchar](50) NULL, [Clicks] [int] NULL, CONSTRAINT [PK_Temp] PRIMARY KEY CLUSTERED ( [id] ASC)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]) ON [PRIMARY]Sample data would beAdGroup = Google, Clicks = 2,AdGroup = MSN, Clicks = 3,AdGroup = Google, Clicks = 1,AdGroup = Yahoo, Clicks = 2etc..How do I write a query that will show me how many "Clicks" there have been per "AdGroup"?Thanks in advance :DDustin |
|
|
singularity
Posting Yak Master
153 Posts |
Posted - 2009-07-03 : 13:49:21
|
| select AdGroup, sum(Clicks) as Clicksfrom Tempgroup by AdGroup |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-07-05 : 03:14:43
|
| it might be better for you to add an audit column like dateentered as well if you need to analyse the clicks per adgroup per day,month,year,.. |
 |
|
|
|
|
|
|
|