Advertisement

04.29.2008 at 04:54PM PDT, ID: 23364019
[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

Query Help - subtotal column only on maximum date

Asked by angelnjj in SQL Query Syntax, Databases Miscellaneous, SQL Reporting

Tags: , , ,

I have included a smippet of a larger query below that provides the following results:

Column headers:
STATCHGDATE                 DBID_BUSINESS           DBID_Property        ENDROOMSAGREED
2005-05-25 00:00:00.000      231457                     19                                 1692
2005-05-25 00:00:00.000      231457                     19                                 1322
2001-12-18 00:00:00.000      231457                     19                                 1660
2001-12-18 00:00:00.000      231457                     19                                 1200

I can't figure out how to return one row for each dbid_business in the table that subtotals the endroomsagreed rooms only for the maximum statchgdate.  The end result I'm looking for is:
2005-05-25 00:00:00.000      231457      19      3014
Any statchgdate prior to the maximum one is irrelevant.

Just so you know, in case it makes a difference.  I'll ultimately inner join the resulting endroomsagreed figure with another portion of the query (that is working well) on the dbid_business (which is unique)

Please HELP!
Start Free Trial
1:
2:
3:
4:
5:
6:
7:
select (business_status_change_date_end) as STATCHGDATE, mart_pace.DBID_BUSINESS,
mart_pace.DBID_PROPERTY, (mart_pace.END_ROOMS_AGREED) AS ENDROOMSAGREED
FROM MART_PACE 
WHERE 
(MART_PACE.BUSINESS_BEGIN_STATUS_DBID <> 3 AND MART_PACE.BUSINESS_END_STATUS_DBID  = 3)
and dbid_property = 19 and YEAR(BUSINESS_DEPARTURE_DATE) IN (2005, 2006, 2007) 
and dbid_business = 231457
[+][-]04.29.2008 at 05:03PM PDT, ID: 21467237

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]04.29.2008 at 05:55PM PDT, ID: 21467403

View this solution now by starting your 7-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

Zones: SQL Query Syntax, Databases Miscellaneous, SQL Reporting
Tags: Microsoft, SQL, 2000, Query Help
Sign Up Now!
Solution Provided By: harfang
Participating Experts: 5
Solution Grade: A
 
 
[+][-]04.29.2008 at 07:41PM PDT, ID: 21467766

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]04.29.2008 at 07:56PM PDT, ID: 21467807

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 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.29.2008 at 08:16PM PDT, ID: 21467854

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]04.30.2008 at 07:17PM PDT, ID: 21476108

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 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.30.2008 at 08:16PM PDT, ID: 21476319

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 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.30.2008 at 09:21PM PDT, ID: 21476500

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 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.30.2008 at 09:29PM PDT, ID: 21476521

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 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628