We help IT Professionals succeed at work.

URGENT HELP! Single Record On A Stored Procedure

191 Views
Last Modified: 2010-07-27
Hello again Experts, I know I am the new thorn in everyones behind but I have a quick question that I'm hoping someone can answer very soon.  I promise this will be the last request on this one!! :)

The below procedure pulls up the proper information but what I am looking for is one record for every InternalExamID that shows the same information that I am now getting in three different records with the below code.  For example every InternalExamID gives me three records that show the ChangeDTTM for 'DICTATE', 'TRANSCRIBE','AUTHENT'.  I need only one record that has those three fields included as opposed to three seperate records. Does that make sence?  Please help!  You guys are great.


CREATE PROCEDURE [dbo].[rptMinimumAuditDiagnosticResultDTTMs]
AS
declare @FirstOfThisMonth datetime
    set @FirstOfThisMonth = dateadd( month, datediff( month, 0, getdate() ), 0 )

    SELECT v.AuditEventType,v.InternalExamID,MIN(ChangeDTTM) as MinimumDate
    FROM dbo.vusrAuditDiagnosticReport v
    WHERE
        ((v.AuditEventType = 'DICTATE') OR (v.AuditEventType = 'TRANSCRIBE') OR (v.AuditEventType = 'AUTHENT'))
        and v.ChangeDTTM >= dateadd( month, -1, @FirstOfThisMonth )
        and v.ChangeDTTM < @FirstOfThisMonth
    GROUP BY v.InternalExamID,v.AuditEventType

GO
Comment
Watch Question

Guy Hengel [angelIII / a3]Billing Engineer
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2009

Commented:
can you post the data you get now, and the one you would get instead.
will make it much clearer.

and yes, it can make "sense".

Author

Commented:
thanks Angel,
What I'm Getting Now 3 records
FIELD NAMES:AUDITEVENTTYPE, INTERNALEXAMID,MINIUMDATE
DICTATE         3248690      2007-08-06 14:56:00.000
TRANSCRIBE 3248690      2007-08-19 20:09:00.000
AUTHENT         3248690      2007-08-10 10:31:00.000

WHAT I WANT TO GET 1 RECORD
FIELD NAMES: INTERNALEXAMID,DICTATE-MINIUMDATE,TRANSCRIBE MINIUMDATE, AUTHEN-MINIUMDATE

So in the data that I am getting now you will notice that the INERNALEXAMID is the same in three records, I want those three records to be just one record with all information





Author

Commented:
hope that makes better sence!!

Author

Commented:
So basically in the output there will never be more then one record for each INTERNALEXAMID
Billing Engineer
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2009
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.