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
 SQL Server Development (2000)
 Query...Group By

Author  Topic 

ramdas
Posting Yak Master

181 Posts

Posted - 2003-09-11 : 14:08:02
Hi,
I have a table which has description of a problem and a created date colum which is of datetime data type. I need to produce a result with the description and datetime grouped by description and datetime for every half hour with the count. For example:

Data

Desc CreatedDate
abc 08-01-2003 00:15:00
def 08-01-2003 00:22:00
abc 08-01-2003 00:24:00
xyz 08-01-2003 00:35:00

Result
Desc CreatedDate Count
abc 08-01-2003 00:00:00 2
def 08-01-2003 00:00:00 1
xyz 08-01-2003 00:30:00 1


Ramdas Narayanan
SQL Server DBA

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-09-11 : 14:16:05
Ramdas, you need to provide the DDL and DML statements in order for us to help. It is much easier for the person needing help to provide this information than for all of us to do it on our own. Please see this thread for what needs to be provided:

[url]http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=29085[/url]

Tara
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2003-09-11 : 14:22:16
check this out, and help us out by making our job easier:

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=29085

EDIT: ahhh, Tara, you got me!

- Jeff
Go to Top of Page

ramdas
Posting Yak Master

181 Posts

Posted - 2003-09-11 : 14:51:01
CREATE TABLE [dbo].[Test] (
[EntityId] [char] (10) NOT NULL ,
[TestId] [int] IDENTITY (1, 1) NOT NULL ,
[ShortDescription] [varchar] (128) NOT NULL ,
[CreationDate] [datetime] NOT NULL ,
[LastModifiedBy] [varchar] (30) NOT NULL ,
[LastModifiedDate] [datetime] NOT NULL ,
[NextTestDate] [datetime] NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO


shortdescription creationdate
--------------------------------
CSR Guide: Address Change 2003-08-01 00:59:35.997
Guide:Change Address, E-mail, Or Phone Numbers 2003-08-01 01:21:46.997
Guide:Change Address, E-mail, Or Phone Numbers 2003-08-01 01:23:36.000
Lead Times Too Long 2003-08-01 01:28:16.000
Lead Times Too Long 2003-08-01 01:28:16.000
CSR Guide: Scheduled Transfers 2003-08-01 01:38:02.997
CSR Guide: Other Request Fulfillment 2003-08-01 01:40:06.997
Guide:Comments or Questions 2003-08-01 02:03:46.000
atm/debit 2003-08-01 02:06:00.000
Guide:Change Address, E-mail, Or Phone Numbers 2003-08-01 02:28:31.997
CSR Guide: Scheduled Transfers 2003-08-01 02:42:13.000

The result needs to be the way i had described in my first post.

Ramdas Narayanan
SQL Server DBA
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2003-09-11 : 14:55:10
I'll get you started on the first couple, then you do the rest:

INSERT INTO Test VALUES ('CSR Guide: Address Change','2003-08-01 00:59:35.997')
INSERT INTO Test VALUES ('Guide:Change Address, E-mail, Or Phone Numbers','2003-08-01 01:21:46.997')

and so on.

Seriously, why should anyone here take the time to do this for you? We are happy to help, but help us out !

Hopefully you can see that if we can just cut and paste into QA to solve your problem, you will get many more results, they will be much more accurate, and fully tested with whatever data you provide.
- Jeff
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-09-11 : 14:55:38
You haven't provided the DML for the sample data. We need INSERT INTO statements for all of the rows. It is much too hard to look at data on a web page. It is much easier to view it in Query Analyzer and play around with it.

Tara
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2003-09-11 : 15:12:24
Should be something on the ASK SQL team page indicating how to ask...



Brett

8-)

SELECT @@POST=NewId()

That's correct! It's an AlphaNumeric!
Go to Top of Page

ramdas
Posting Yak Master

181 Posts

Posted - 2003-09-11 : 15:38:52
Hi,
I am sorry for all the trouble caused. I found the solution.
Will post all details before submitting the post.
Thank you

Ramdas Narayanan
SQL Server DBA
Go to Top of Page
   

- Advertisement -