Advertisement

04.22.2008 at 10:10AM PDT, ID: 23343800
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.4

Concatenating in a Group By

Asked by Trudye in SQL Query Syntax

Tags: , , ,

Hi Guys, I am converting Access SQL to SQL Server and I have two problems:
First of all I cant get the city, state and zip to concatenate. It will not take the "As Location"  and it will not allow me to concatenate the fields in the Group By area.
Second I m trying to replace a First() function with a Top() function but Im not having much success.  If it is not the first statement I get an error (Incorrect syntax near the keyword 'TOP'.)

Any ideas how I can accomplish what it is I want to do?

Thanx much,
Trudye

BEGIN
      
      SELECT Date AS DateEntered,
       LTRIM(RTrim([ResultsCustName])) AS CustName,
      Timestamp, LTRIM(RTrim([ResultsPH])) AS Phone,
      TOP (1) tblEscalationData.Explain_followup AS FirstOfExplain_followup,
      [ResultsAddr1] AS Address1, [ResultsAddr2] AS Address2,
      [ResultsCity] AS City, [ResultsST] AS [State], [ResultsZip] AS Zip,
      ERROR
INTO zTmp_Training
FROM tblEscalationData
      LEFT JOIN qry_IssuesPrint
      ON tblEData.ResultsPKey = qry_IssuesPrint.ResultsPKey
      LEFT JOIN LOOKUP_DATA
      ON tblEData.DSLOAN = LOOKUP_DATA.DSLOAN
      LEFT JOIN qry_IssuesPrintDef
      ON tblEData.ResultsPKey = qry_IssuesPrintDef.ResultsPKey
      INNER JOIN qry_CurrentStatus
      ON tblEData.ResultsPKey = qry_CurrentStatus.ResultsPKey
      LEFT JOIN tblErrors
      ON Error = SUBID
WHERE tblEData.CSRReporting= 1 AND
      qry_CurrentStatus.Date
             Between @Start_Date And @End_Date
             AND Source = @CallCtr
             AND ERROR Is Not Null
ORDER BY LTrim(RTrim([ResultsCustName]))

END      
--qry_CSRTraining (Group BY Clause)
BEGIN
      SELECT DateEntered, LTrim(RTrim([CustName])), [Timestamp],
      LTrim(RTrim([Phone])),
      [Address1] + ' ' [Address2],
      [City] + ' ' + [State] + ' ' + [Zip] As Location,
      [Name], ERROR
      FROM zTmp_Training
      GROUP BY DateEntered, [CustName], [Timestamp],
      [Phone], [Address1], [Address2], Location,
      [Name], ERROR
END
Start Free Trial
[+][-]04.22.2008 at 10:22AM PDT, ID: 21413372

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.23.2008 at 03:36AM PDT, ID: 21419095

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 14-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.23.2008 at 03:55AM PDT, ID: 21419225

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.23.2008 at 05:13AM PDT, ID: 21419719

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 14-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.23.2008 at 07:44AM PDT, ID: 21421224

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.23.2008 at 10:11AM PDT, ID: 21423002

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 14-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.23.2008 at 10:43AM PDT, ID: 21423313

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.24.2008 at 04:26AM PDT, ID: 21429571

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 14-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.24.2008 at 05:01AM PDT, ID: 21429830

View this solution now by starting your 14-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: SQL Query Syntax
Tags: Microsoft, sql server, 2005, t-sql
Sign Up Now!
Solution Provided By: ee_rlee
Participating Experts: 1
Solution Grade: A
 
 
[+][-]04.25.2008 at 04:40AM PDT, ID: 21438424

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 14-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-43 / EE_QW_2_20070628